Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 10/24/26 01:52
Tradestation missing in table of contents
by AndrewAMD. 10/23/26 14:35
No connection to MT4
by JeyKey II. 10/22/26 15:33
Zorro tutorial ideas?
by mistery. 10/21/26 05:28
Avoid "log\ - delete old files" message
by Martin_HH. 10/20/26 07:23
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 7,375 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
JimSimons, julienp, julienper, KelleyAbbey, Yopachi
19246 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Triggering a variable change upon collision? #425511
07/07/13 05:25
07/07/13 05:25
Joined: Apr 2013
Posts: 19
Zyro_Falcon Offline OP
Newbie
Zyro_Falcon  Offline OP
Newbie

Joined: Apr 2013
Posts: 19
I have a rigidbody entity in a wmb level, PhysX enabled. The entity is able to collide with the level blocks and rebound appropriately.

One thing's stumping me... I want to be able to set my entity's variable 'shield' to 0 when it collides with the level blocks, but I haven't figured out how.

Below is my attempt, which the program does not understand. Is there something wrong with the code, or the wmb level blocks?

-----------------------------------

var shield = 750;

function collision()
{
if (event_type == EVENT_BLOCK) {shield = 0;}
}

action zfxengine()
{
pXent_settype (me, PH_RIGID, PH_BOX);
pXent_setmass (me, 0);
pXent_setgroup (me, 2);

my.emask |= ENABLE_BLOCK;
my.event = collision;
while(1)
{
...
...
}
}

Re: Triggering a variable change upon collision? [Re: Zyro_Falcon] #425512
07/07/13 07:21
07/07/13 07:21

M
Malice
Unregistered
Malice
Unregistered
M



EVENT_FRICTION
ENABLE_FRICTION

Re: Triggering a variable change upon collision? [Re: ] #425513
07/07/13 07:42
07/07/13 07:42
Joined: Apr 2013
Posts: 19
Zyro_Falcon Offline OP
Newbie
Zyro_Falcon  Offline OP
Newbie

Joined: Apr 2013
Posts: 19
Ok, tried your suggestion, didn't work either... frown

Re: Triggering a variable change upon collision? [Re: Zyro_Falcon] #425515
07/07/13 08:12
07/07/13 08:12
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
The collision events with physX are activated with 'pXent_setcollisionflag'

Code:
pXent_settype ( ent, PH_RIGID, PH_SPHERE );
pXent_setcollisionflag (ent, NULL, NX_NOTIFY_ON_START_TOUCH ); //trigger EventImpact on collision with level
ent.event = EventImpact;



Re: Triggering a variable change upon collision? [Re: txesmi] #425516
07/07/13 08:36
07/07/13 08:36
Joined: Apr 2013
Posts: 19
Zyro_Falcon Offline OP
Newbie
Zyro_Falcon  Offline OP
Newbie

Joined: Apr 2013
Posts: 19
Darn it, I read through the page containing that command and I forgot about it. Thanks, it works

<-- I, le student


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