|
Hi! I'm trying to control and rotate a player character based on the joystick input like e.g. Torchlight and Magicka. If you hold the joystick up-left, I want the player character to immediately rotate and face that direction and walk to that position, while having the character always being angled at e.g. a 30 degree angle. If you hold the joystick down-right, the player character should rotate and face that direction and walk there. The problem I'm having is keeping the player character at the 30 degree angle while rotating him towards the joystick angle. Here's an image trying to explain what I currently have (the "Wrong" one), and what I hope to achieve (the "Right" one):
Here's the code I currently use, which works for everything BUT does not keep the player at the right 30 degree angle: Basically, I want what the line below does, as it rotates it correctly at the angle it's currently on, but instead rotate it to the joystick's direction: GoPlayer.transform.Rotate(Vector3.up * (Time.deltaTime * 100.0f)); Thanks!
(comments are locked)
|


In Magicka, the character moves on the horizontal plane (ZX), but in this script the character goes up and down (Y axis) instead of forth and back. Is it the intended behavior?
Hi aldonaetto. The way I'm currently doing it having the 3D player object on top of a 2D map (made using SM2), so in that regard, I need it to move it along the X/Y axis while keeping the Z axis constant, so it doesn't move behind the 2D map, if that makes any sense :) But I can change the axis of it all though, e.g. make the 2D map be horizontal instead of vertical, whatever makes it work :) Thanks!
If I had to make a game like that, I would use the map at the ZX plane and the camera in perspective projection, adjusting its position in order to have a somewhat similar view, and never would try to tilt the characters. But if you want to reproduce the Magicka style more closely, maybe you have to use the camera in ortographic mode (set it in the Projection field). You can place the map at ZX or XY plane, but I think ZX plane is easier. I think you can get good results without tilting the characters away from the camera. Are you sure you'll need to do that?
Doh, that is a much easier solution! I was thinking about it the wrong way :) I will try to do this instead as it should work out well. Thanks aldonaletto!