xtreampb Posted November 22, 2014 Share Posted November 22, 2014 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? Quote 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 More sharing options...
Josh Posted November 22, 2014 Share Posted November 22, 2014 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. 2 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...
xtreampb Posted November 26, 2014 Author Share Posted November 26, 2014 when will this new line of code take effect? Quote 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 More sharing options...
Josh Posted November 27, 2014 Share Posted November 27, 2014 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. 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...
xtreampb Posted November 27, 2014 Author Share Posted November 27, 2014 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. Quote 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 More sharing options...
Josh Posted November 27, 2014 Share Posted November 27, 2014 Use GetRotation().y then. That's the yaw. 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...
xtreampb Posted November 27, 2014 Author Share Posted November 27, 2014 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? Quote 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 More sharing options...
gamecreator Posted November 27, 2014 Share Posted November 27, 2014 If you just want to rotate the model, attach it to a pivot first like in the SetInput documenation example. Quote Link to comment Share on other sites More sharing options...
Josh Posted November 27, 2014 Share Posted November 27, 2014 The character controller cannot handle rotation around the X and Z axes. 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...
Haydenmango Posted November 27, 2014 Share Posted November 27, 2014 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. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
gamecreator Posted November 27, 2014 Share Posted November 27, 2014 If you parent it like in the example, you don't even need to use SetPosition (it will be attached and follow automatically). 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.