Hi there
I try to use an Egg as a player Character. The Player should be able to rotate the egg in four directions (up/down/left/right). I tried different approaches to achieve my goal but do not seem to get nearer to the required output.
LocalEulerAngles:
{
switch (_requiredDirection)
{
case MovementRequest.Up:
_playerBody.transform.localEulerAngles= new Vector3(0, 0, 90);
break;
}
_requiredDirection = MovementRequest.None;
}
This rotates the egg but it isn’t smooth. It simply puts the egg in that angle in one frame and thats it.
The same result when using rotate instead: _playerBody.transform.Rotate(new Vector3(0, 0, 1), 90);
This is when “Automatic Center of Mass” is selected on the RigidBody. It rotates to the 90 Degree position in one Frame and stays there.
If I change the center of mass manualy, it also jumps to the 90 degree angle. but bounces a while afterwards.
So what I think I need to have is a force that “pushes” the egg causing a rotation and then stopping that force once the required position is achieved.
As this seems to be quite a basic task I am already happy for the right direction. Checked a lot of rotation documents and Videos but none seems to match my requirements
Thanks
If I need to privide any additional information I am happy to give them
Thanks a lot. The movement looks nearly as I wanted it to look. But I do not want a continuous movement and limit the movement to the four axes. So no Diagonal and one single buttonpress (WASD) should only result in one small 90 Degree movement.
(I can code the Input-stuff itself, just need a single “Rotate 90 degrees in Direction X” example and can add the rest myself)