Zone of the Mecha: How does it work?

View previous topic View next topic Go down

Zone of the Mecha: How does it work?

Post by InfinitasImpetum on Sun Jul 27, 2014 11:31 pm

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.

InfinitasImpetum
(0%)-Lv8
(0%)-Lv8

Posts : 2160
Join date : 2012-05-30
Age : 27

View user profile

Back to top Go down

Re: Zone of the Mecha: How does it work?

Post by InfinitasImpetum on Mon Aug 04, 2014 8:45 pm

added movement explaination.

__________________________________________________________________________________________


InfinitasImpetum
(0%)-Lv8
(0%)-Lv8

Posts : 2160
Join date : 2012-05-30
Age : 27

View user profile

Back to top Go down

Re: Zone of the Mecha: How does it work?

Post by mangak (GONE) on Tue Aug 05, 2014 6:25 am

keep it up

__________________________________________________________________________________________

mangak (GONE)
(100%)-Lv8
(100%)-Lv8

Posts : 3910
Join date : 2010-10-09
Currently : Freagin Heaven!!

View user profile http://www.winz00e.com

Back to top Go down

Re: Zone of the Mecha: How does it work?

Post by Sponsored content Today at 12:18 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum