Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,789 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
phent_addforcelocal #86160
08/15/06 14:37
08/15/06 14:37
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
I know I've posted a lot of issues about Newton, I'm kinda in between newton and A6 physics. I'm trying to get a bullet impact working for the A6 physics, but no success... spins, no movement and it always spins in one dircetion. My code:

Code:
 

function physics_hit
{
if (you.skill1 == 4) //checks if entity that hit it was a bullet
{
var force_vector;
force_vector.x = you.skill8*10;
force_vector.y = 0;
force_vector.z = 0;
vec_rotate(force_vector, you.pan); //rotates it to give direction of bullet
phent_addforcelocal (my, force_vector, you.x);
}
}

Action PhysicsCrate
{
my.skill96 = 1; //smoke
my.skill98 = 1; //sparks
my.skill99 = 1;//I'm a physics object
phent_settype(my, PH_RIGID, PH_BOX); // sets the object within the physics engine
phent_setmass(my, 10, PH_BOX); // set the entity's mass
phent_setfriction(my,30); // set the enitity's friction\
phent_setdamping(my,50,100);
phent_setelasticity(my, 0, 0); // set the enitity's elasticity
phent_enable(my, ON); // enable the phent enitity
my.ENABLE_IMPACT = on;
my.event = physics_hit;
}




Anybody know how to fix this?

Re: phent_addforcelocal [Re: vartan_s] #86161
08/15/06 16:38
08/15/06 16:38
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Maybe force_vector should be a vector (var force_vector[3];)

Re: phent_addforcelocal [Re: vartan_s] #86162
08/15/06 20:39
08/15/06 20:39
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Have you set "ph_setgravity" ?
Also try "phent_enable(my, 1)" insteat of "phent_enable(my,0)"
Btw. you don´t need "phent_enable" in this case, you could delete this line. You´ve registered the entity as physics object with "phent_settype".


no science involved
Re: phent_addforcelocal [Re: fogman] #86163
08/16/06 18:52
08/16/06 18:52
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
No, that's not the problem. You see, it is working well in terms of physics, gravity and all, but not acting like a bullet hit it with addforcelocal. I need to know if this is the instruction to use, if so how to use it and if not what the correct instruction is. Anybody know how to do this?

Re: phent_addforcelocal [Re: vartan_s] #86164
08/16/06 20:30
08/16/06 20:30
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Try this:
Code:

var force_vector[3];
function physics_hit()
{
if (event_type == event_impact)&&(you.skill1 == 4)
{
force_vector.x = you.skill8*10;
force_vector.y = 0;
force_vector.z = 0;
vec_rotate(force_vector, you.pan);
phent_addforcelocal (my, force_vector, you.x);
}
}


Maybe you could use phent_addcentralforce(my, vector_force) to apply a linear force in the entity´s center of mass.

Re: phent_addforcelocal [Re: demiGod] #86165
08/16/06 21:05
08/16/06 21:05
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
No... that's not it... I don't need to check for event_impact because its the only thing being detected here. And no I don't want central force because it doesn't give the object any spin.

Anyway I solved the problem after I realised the vecPoint was relative to the object... so nullvector or vector(0,0,0) would be the center of the physics object not the center of the level... works fine now, thanks for the help


Moderated by  HeelX, Spirit 

Gamestudio download | 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