Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (ozgur), 762 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 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 | 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