vehicles aligning to hilly terrain

This commit is contained in:
devZoGok
2025-10-19 16:09:44 +03:00
parent 00af4433d3
commit d769e5cbf6
4 changed files with 196 additions and 34 deletions
+4 -1
View File
@@ -517,7 +517,10 @@ namespace battleship{
if(type == UnitType::LAND){
vector<RayCaster::CollisionResult> res = RayCaster::cast(Vector3(p.x, 100, p.z), -Vector3::VEC_J, vector<Node*>{map->getNodeParent()->getChild(0)}, 0, 20);
p.y = res[0].pos.y;
float angle = upVec.getAngleBetween(res[0].norm);
if(angle > 0)
model->lookAt(leftVec.cross(res[0].norm), res[0].norm);
}
ActiveGameState *activeState = (ActiveGameState*)GameManager::getSingleton()->getStateManager()->getAppStateByType(AppStateType::ACTIVE_STATE);