Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (MadJack, AndrewAMD, Quad), 540 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
EVENT_ENTITY with PhysX #442584
06/25/14 21:34
06/25/14 21:34
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline OP
Member
CanadianDavid  Offline OP
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
I notice that when I use the PhysX engine to move an object, the EVENT_ENTITY never triggers despite saying in the documentation that it also responds to "physics entity movement".

Consider the following code (download demo):
Code:
#include <acknex.h>
#include <ackphysx.h>

function ball_event(){
	beep();
}

action ball(){
	my.emask |= ENABLE_ENTITY;
	my.event = ball_event;
	pXent_settype (me, PH_RIGID, PH_SPHERE); // set the physics entity type
	pXent_setfriction (me,50); // set the friction on the ground
	pXent_setdamping (me,10,10); // set the damping
	pXent_setelasticity (me,50); // set the elasticity
	
	while(1){
		//c_move(me,nullvector,vector(time_step,0,0),GLIDE);
		pXent_addforcecentral(me,vector(time_step,0,0));
		wait(1);
	}
}

action hero(){
	player = me;
	while(1){
		vec_set(camera.x, my.x);
		camera.pan = my.pan;
		c_move(me,vector(key_w-key_s,key_a-key_d,0),nullvector,GLIDE);
		wait(1);
	}
}

void main() {
	physX_open();
	level_load("level1.wmb");
}

When the ball collides with the player using c_move, the event is triggered and a beep is heard. When PhysX is used, the event is not triggered. How can I trigger an EVENT_ENTITY using PhysX?

Re: EVENT_ENTITY with PhysX [Re: CanadianDavid] #442586
06/25/14 21:53
06/25/14 21:53
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
Hi,
take a look to pXent_setcollisionflag.

Salud!

Re: EVENT_ENTITY with PhysX [Re: txesmi] #442597
06/26/14 09:18
06/26/14 09:18
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline OP
Member
CanadianDavid  Offline OP
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
To react with the player, would I need to either register the player model as a PhysX enabled object or attach a dummy PhysX object to it for it to work? How might I attach a dummy PhysX object to the player model since I cannot modify the xyz values directly unless I first unregister the dummy object?

My current player model is not a registered PhysX object; the player is moved using c_move instructions.


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