Jump to content

Set Rotation not rotating


xtreampb
 Share

Recommended Posts

so i have this code in C++

Entity *spawn = world->FindEntity("Spawn");


Entity *player = Prefab::Load("Prefabs/Player/FPSPlayer.pfb");
player->SetPosition(spawn->GetPosition());
player->SetRotation(spawn->GetRotation(),true);

 

problem is, my player isn't being rotated. It's position is being set, but it isn't being rotated. Could someone give me some insights please?

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

You need to set the input to control its angle since it is using character controller physics.

 

I just added a line of code that will automatically set the character controller rotation to the yaw in this command, so it acts more like you expect.

  • Upvote 2

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

Well, I added it in and then it caused a problem and I took it out.

 

You can use Math::ATan2 to figure out the correct angle from the difference between the two entity positions.

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

i have the amount that my controller needs to turn. It just isn't making sense how to translate a rotation on 3 axis' to a single float value.

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

but what if i wanted to rotate my controller along the z or x axis? set input just takes a single float, how would i translate this?

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

A work around is to make a pivot your character controller then make your model follow that pivot using SetPosition() as well as SetRotation().

That way you can alter your models x and z rotation while still using a character controller for movement.

Link to comment
Share on other sites

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.

Guest
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.

 Share

×
×
  • Create New...