Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, alibaba), 704 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Missile Physics #292537
10/04/09 15:43
10/04/09 15:43
Joined: Sep 2008
Posts: 69
U
upsidedownman Offline OP
Junior Member
upsidedownman  Offline OP
Junior Member
U

Joined: Sep 2008
Posts: 69
Hi i am trying to put physics on my missile, it isn't a straight shooting missile it is like when you shoot from a tank at a certain point it curves downward. I put the physics on the missile and everything works fine except i can not get it to curve its tilt down, here is what i have.

Code:
function shoot()
{
	VECTOR shoot;
	shoot.x = 900; shoot.y = 0; shoot.z = 0;
	vec_rotate(shoot,player.pan);
	phent_addvelcentral(my,shoot);
	phent_addtorquelocal(my,vector(0,10,0));//curves the tilt down but not correctly
}

function physics_func()
{

		phent_settype(my,PH_RIGID,PH_BOX);
		phent_setmass(my,my.mass,PH_BOX);

	phent_setfriction(my,10);
	phent_setelasticity(my,0,100);  
	phent_setdamping(my,0,0);   
	ph_setgravity(vector(NULL,NULL,-500));
	shoot();
}



I use the torque to curve the tilt down but the problem is sometimes the missile doesn't curve enough and sometimes to much, the velocity and the angle of the missile when fired changes just about every time it is shot so i can't really just do trial and error until i get a torque that will work right, is there anyway to do this?

Thanks.

Re: Missile Physics [Re: upsidedownman] #339041
08/24/10 03:02
08/24/10 03:02
Joined: May 2010
Posts: 8
Singapore
C
CaedLucin Offline
Newbie
CaedLucin  Offline
Newbie
C

Joined: May 2010
Posts: 8
Singapore
Does anyone have any solution to this? I also need to make the missle curve and land on its nose.

Re: Missile Physics [Re: CaedLucin] #339042
08/24/10 03:17
08/24/10 03:17
Joined: Mar 2009
Posts: 146
USA
P
paracharlie Offline
Member
paracharlie  Offline
Member
P

Joined: Mar 2009
Posts: 146
USA
shoot.z -= 0.4 * time_step; ? Try something like that.


A8 Commercial
Re: Missile Physics [Re: paracharlie] #339046
08/24/10 06:09
08/24/10 06:09
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
check out my mortar cannon demo , its not physics but does what you want.

Re: Missile Physics [Re: badapple] #339047
08/24/10 06:25
08/24/10 06:25
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
instead of changing z, try:
Code:
my.tilt-=time_frame*5;




Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1