void GameTSCtrl::onMouseMove(const GuiEvent &evt) { if(gSnapLine) return; MatrixF mat; Point3F vel; if ( GameGetCameraTransform(&mat, &vel) ) { Point3F pos; mat.getColumn(3,&pos); Point3F screenPoint((F32)evt.mousePoint.x, (F32)evt.mousePoint.y, 1.0f); Point3F worldPoint; if (unproject(screenPoint, &worldPoint)) { Point3F vec = worldPoint - pos; lineTestStart = pos; vec.normalizeSafe(); lineTestEnd = pos + vec * 500; static U32 losMask = VehicleObjectType | StaticShapeObjectType; RayInfo ri; bool hit = gClientContainer.castRay( lineTestStart, lineTestEnd, losMask, &ri); if (!hit) { //Con::printf("no hit!"); if (mCursorObject != NULL) mCursorObject->setHighlighted(false); mCursorObject = NULL; } else { if (ri.object != mCursorObject && mCursorObject != NULL) mCursorObject->setHighlighted(false); mCursorObject = (ShapeBase*)ri.object; mCursorObject->setHighlighted(true); } } } }
void GameTSCtrl::onMouseMove(const GuiEvent &evt) { if(gSnapLine) return; MatrixF mat; Point3F vel; if ( GameGetCameraTransform(&mat, &vel) ) { Point3F pos; mat.getColumn(3,&pos); Point3F screenPoint((F32)evt.mousePoint.x, (F32)evt.mousePoint.y, -1.0f); Point3F worldPoint; if (unproject(screenPoint, &worldPoint)) { Point3F vec = worldPoint - pos; lineTestStart = pos; vec.normalizeSafe(); lineTestEnd = pos + vec * 1000; } } }