www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: phlux on August 09, 2013, 04:31:50 pm

Title: Animated rotation of the camera 90 degree wise
Post by: phlux on August 09, 2013, 04:31:50 pm
Hi again.

I'm still on my prototype of my dungeon crawler thing demo. However I'm not quite sure how to implement 90 degree wise camera rotation.
I'm using the advanced example from the wiki as a source base. The example uses ticks for animation. My idea was that the camera needs some defined amount of ticks to finish a 90 rotation. So if a keypress to rotate the camera is detected I would use the animate() function from the example to rotate the camera until an amound of ticks is reached. Say a rotation would take 100 ticks for 90 degrees, so I would rotate the camera 0.9 degree each tick.

Is this the correct approach or is there a better way to accomplish this kind of camera movement?

I've seen that there is already some functions like checkCameraCollision() in the World class for basic cam movement (forward/backward). How are these implemented? Also are these suited for non rotational movement in a dungeon crawler?

Thanks again,
Chris
Title: Re: Animated rotation of the camera 90 degree wise
Post by: Gatobot on August 09, 2013, 05:52:12 pm
yes , the approach your using for camera rotation is ok, this will give a smooth animation everytime you turn,  you should use grid based movement instead of checking for collisions with the camera, i think its better for this kind of games.
Title: Re: Animated rotation of the camera 90 degree wise
Post by: EgonOlsen on August 10, 2013, 09:29:33 am
you should use grid based movement instead of checking for collisions with the camera, i think its better for this kind of games.
I second this. It's much easier and more feasible for this kind of game.
Title: Re: Animated rotation of the camera 90 degree wise
Post by: phlux on August 10, 2013, 10:58:53 am
you should use grid based movement instead of checking for collisions with the camera, i think its better for this kind of games.
I second this. It's much easier and more feasible for this kind of game.

Okay so i'm on the correct way for the rotation. What method should I use for directional movement? When I move from tile to tile I need to move two units (as plates have a width of two and you stand in the middle). Shall I use moveCamera with a vector and a speed which equals the current tick count or shall I use setPosition with a vector with a small increased amount in a direction (the same tick/unit ratio like for the rotation)?
Title: Re: Animated rotation of the camera 90 degree wise
Post by: EgonOlsen on August 10, 2013, 08:06:27 pm
That's totally up to you. Use whatever fits your needs.
Title: Re: Animated rotation of the camera 90 degree wise
Post by: phlux on August 11, 2013, 09:33:07 am
Okay, I take that as both work  ;D