Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How I change the initial rotation of my ship?


Recommended Posts

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)) {
if(window->KeyDown(Key:)) {
if(window->KeyDown(Key::S)) {
if(window->KeyDown(Key::W)) {


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?

Link to post

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.

Link to post

Thanks! This worked for me!


ship = Model::Load("Models/Ship/dark_fighter_6.mdl");
shipPivot = Pivot::Create();
ship->SetRotation(90,90,0, true);


if(window->KeyDown(Key::A)) {



There's some pattern to handle this in more global manner?

Edited by wdna
Link to post

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.

Link to post

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...