Zone of the Mecha: How does it work?
2 posters
Page 1 of 1
Zone of the Mecha: How does it work?
well, making this thread to help other who are curious on how my code works. will not be posting any code though but explaining how it works.
The Camera
first thing the Camera,to achieve a camera that behaves the way it does and look at both the player and the target i had to first set the position of the camera to be the center point or offset point you can say of the player. then in order for it to follow the target i have the camera look at the target. after its rotated to point/look at the target i back the camera up so its then behind the player. this then achieves the desire effect i require for the camera. if the player isn't locked on to anything, i have the camera copy the player rotation data so it looks like its following the player.
The Movement
how does the movement work? well first i get a speed value telling how fast it goes. using that value i determine that when you go towards or away from the enemy you move at that exact speed. how do i handle rotation around the target? i first get the radius of the circle that is created from the distance between the player an the the target then i use that to calculate the circumference aka distance around a circle. using speed i divide the speed by the circumference and then multiple it by 360. by doing this i get the angular speed of the player when going around the target. setting rotation is done by making the player look opposite from the previous position it was at.
The Camera
first thing the Camera,to achieve a camera that behaves the way it does and look at both the player and the target i had to first set the position of the camera to be the center point or offset point you can say of the player. then in order for it to follow the target i have the camera look at the target. after its rotated to point/look at the target i back the camera up so its then behind the player. this then achieves the desire effect i require for the camera. if the player isn't locked on to anything, i have the camera copy the player rotation data so it looks like its following the player.
The Movement
how does the movement work? well first i get a speed value telling how fast it goes. using that value i determine that when you go towards or away from the enemy you move at that exact speed. how do i handle rotation around the target? i first get the radius of the circle that is created from the distance between the player an the the target then i use that to calculate the circumference aka distance around a circle. using speed i divide the speed by the circumference and then multiple it by 360. by doing this i get the angular speed of the player when going around the target. setting rotation is done by making the player look opposite from the previous position it was at.
InfinitasImpetum- (0%)-Lv8
- Posts : 2162
Join date : 2012-05-30
Age : 34
Re: Zone of the Mecha: How does it work?
added movement explaination.
InfinitasImpetum- (0%)-Lv8
- Posts : 2162
Join date : 2012-05-30
Age : 34
Similar topics
» Zone of the Mecha (upcoming game in the works)
» Zone Of The Enders: Anubis HD Edition CANCELLED! D:
» Going To Work 5 Days A Week
» Finally got my graphics card to work.. and here's a GAYm play...
» WE GOT MECHA IN MINECRAFT!!!!
» Zone Of The Enders: Anubis HD Edition CANCELLED! D:
» Going To Work 5 Days A Week
» Finally got my graphics card to work.. and here's a GAYm play...
» WE GOT MECHA IN MINECRAFT!!!!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum