wdna Posted May 22, 2014 Share Posted May 22, 2014 I found a free model I can play with of nice quality. I have the following situation: Like you can see the models initial rotation is wrong, it should be facing the direction of brush. This code can fix the rotation for me: ship->SetRotation(90,90,0, true); But then I have issue with ship movement: if(window->KeyDown(Key::A)) { ship->Move(-move_speed,0,0); } if(window->KeyDown(Key:)) { ship->Move(move_speed,0,0); } if(window->KeyDown(Key::S)) { ship->Move(0,0,-move_speed); } if(window->KeyDown(Key::W)) { ship->Move(0,0,move_speed); } Movement would be in the wrong then directions. I could also adjust this but obviously it's not the right way. I am aware you can rotate it in some 3D software like blender, but I'm trying to avoid it right now. and generally what would be best practice for such cases? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted May 22, 2014 Share Posted May 22, 2014 Set the movement to global instead of local. Then everything should work just fine. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitymove-r165 Quote Link to comment Share on other sites More sharing options...
Josh Posted May 22, 2014 Share Posted May 22, 2014 You could create a pivot entity, then call Entity::SetParent() to parent the ship to the pivot, and then call your commands on the pivot. That would basically fix the model's orientation to be the way you want. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
wdna Posted May 22, 2014 Author Share Posted May 22, 2014 (edited) Thanks! This worked for me! ship = Model::Load("Models/Ship/dark_fighter_6.mdl"); ship->SetPosition(0,4,0); shipPivot = Pivot::Create(); ship->SetParent(shipPivot); ship->SetRotation(90,90,0, true); ... if(window->KeyDown(Key::A)) { shipPivot->Move(-move_speed,0,0); } ... There's some pattern to handle this in more global manner? Edited May 22, 2014 by wdna Quote Link to comment Share on other sites More sharing options...
Rick Posted May 22, 2014 Share Posted May 22, 2014 Bring it into a modeling package and export it rotated correctly. I used to do this in UU3D. I'm sure there are free options. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted May 24, 2014 Share Posted May 24, 2014 I think rotate and move commands in the model editor, below scale, would come in really handy. Rotate would rotate the model around its origin/anchor, whether that's at the bottom of the feet or middle of the model or wherever. Move would move the model relative to the origin/anchor. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.