2 registered members (AndrewAMD, SBGuy),
987
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: AckphysX3 development thread
[Re: 3dgs_snake]
#420979
04/08/13 05:03
04/08/13 05:03
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
Updated physX3 plugin ( v0.90.2.0 - physX 3.2.2 ). The main features are : - Some bugfixes (Update loop, CCT, capsulecheck)
- More stable
- Added :
- pX3_gpusupport : Check GPU support
- New functions for raycast with one additional ignoreFlag parameter (pX3_*_ignore) that can be used to filter entities (PX_IGNORE_ME, PX_IGNORE_YOU, PX_IGNORE_FLAG2, PX_IGNORE_PASSABLE)
- ...
- Removed watermark (the plugin is free for non commercial use)
Last edited by 3dgs_snake; 04/08/13 05:13.
|
|
|
Re: AckphysX3 development thread
[Re: 3dgs_snake]
#420989
04/08/13 11:05
04/08/13 11:05
|
Joined: Jan 2013
Posts: 17
BySharDe2
Newbie
|
Newbie
Joined: Jan 2013
Posts: 17
|
Excellent! BTW, what is the relation between nowaday PhysX plugin and "native" acknex's PhysX plugin ?
Last edited by BySharDe2; 04/08/13 11:06.
|
|
|
Re: AckphysX3 development thread
[Re: Emre]
#421046
04/09/13 04:44
04/09/13 04:44
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
Hi, That's strange, I thought that the bug was in the previous versions, for me it is working. Try the code bellow (create a level in WED with a simple box in the center)
#include <acknex.h>
#include <default.c>
#include <ackphysX3.h>
#define PRAGMA_PATH "C:\\Program Files (x86)\\GStudio8\\templates\\sounds";
SOUND *snd_left="shot1.wav";
SOUND *snd_impact = "aiimpact.wav";
SOUND *trigger_enter = "tap.wav";
SOUND *trigger_leave = "splash.wav";
ENTITY *cube1 = NULL;
ENTITY *cube2 = NULL;
ENTITY *trigger = NULL;
// Impact event :
void impact_event()
{
if (event_type == EVENT_FRICTION && hit->flags & PX_EVENT_TOUCH_LOST)
{
ent_playsound(me, snd_left, 100);
}
else if (event_type == EVENT_FRICTION && hit->flags & PX_EVENT_TOUCH_FOUND)
{
ent_playsound(me, snd_impact, 100);
}
}
// Cube action :
void cube_action()
{
while(trigger == NULL || cube2 == NULL) wait(1);
pX3ent_settype(me, PH_RIGID, PH_BOX);
set(me, SHADOW);
pX3ent_setcollisionflag(me, NULL, PX_PF_NOTIFY_TOUCH);
//pX3ent_setcollisionflag(me, cube2, PX_PF_NOTIFY_TOUCH_LOST);
me->event = impact_event;
}
// Trigger event :
void trigger_event()
{
if (event_type != EVENT_TRIGGER)
return;
if (hit->flags & PX_EVENT_TOUCH_FOUND)
ent_playsound(me, trigger_enter, 100);
if (hit->flags & PX_EVENT_TOUCH_LOST)
ent_playsound(me, trigger_leave, 100);
}
// Trigger action :
void trigger_action()
{
while(cube1 == NULL || cube2 == NULL) wait(1);
pX3ent_settype(me, PH_STATIC, PH_BOX);
pX3ent_settriggerflag(me, PX_TF_TRIGGER_ENABLE, 1);
me->event = trigger_event;
}
// App entry point
void main()
{
// Open physX :
physX3_open();
// Level config :
shadow_stencil = 2;
// Load level :
level_load("IMPACT_LEVEL.WMB");
vec_set(camera.x, vector(-253, -6, 128));
camera.tilt = -26;
// Create cube :
cube1 = ent_create(CUBE_MDL, vector(0, 0, 300), cube_action);
cube2 = ent_create(CUBE_MDL, vector(0, 0, 30), NULL);
trigger = ent_create(CUBE_MDL, vector(0, 0, 60), trigger_action);
vec_set(trigger->scale_x, vector(2, 2, 2));
set(trigger, TRANSLUCENT);
pX3ent_settype(cube2, PH_RIGID, PH_BOX);
wait(-5);
pX3ent_addforcecentral(cube1, vector(0, -5, 10));
diag(str_printf(NULL, "Cube1:%X, Cube2:%X, Cube3:%X\n", handle(cube1), handle(cube2), handle(level_ent)));
}
|
|
|
Re: AckphysX3 development thread
[Re: 3dgs_snake]
#421048
04/09/13 05:48
04/09/13 05:48
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Thanks. Yes your code is works but i don't want to use trigger action. Try this code:
#include <acknex.h>
#include <default.c>
#include <ackphysX3.h>
#define PRAGMA_PATH "C:\\Program Files\\GStudio8\\templates\\sounds";
#define PRAGMA_PATH "C:\Program Files\\GStudio8\templates\models";
#define PRAGMA_PATH "C:\\Program Files (x86)\\GStudio8\\templates\\sounds";
#define PRAGMA_PATH "C:\\Program Files (x86)\\GStudio8\\templates\\models";
SOUND *snd_impact = "aiimpact.wav";
ENTITY* terrain_ent;
// Impact event :
void impact_event()
{
if (event_type == EVENT_FRICTION)
{
ent_playsound ( my, snd_impact,100);
}
}
// App entry point
void main()
{
// Open physX :
physX3_open();
// Load level :
level_load("");
vec_set(camera.x, vector(-253, -6, 128));
camera.tilt = -26;
// Create cube :
terrain_ent = ent_create("water.hmp", vector(0, 0, 0), NULL);
pX3ent_settype(terrain_ent, PH_STATIC, PH_TERRAIN);
}
VECTOR p_target;
VECTOR kick_vec;
void on_space_event()
{
p_target.x=camera.x+cos(camera.pan)*cos(camera.tilt)*50;
p_target.y=camera.y+sin(camera.pan)*cos(camera.tilt)*50;
p_target.z=camera.z+sin(camera.tilt)*50;
you=ent_create(CUBE_MDL, p_target.x, NULL);
pX3ent_settype(you, PH_RIGID, PH_BOX);
you.emask|=(ENABLE_FRICTION);
pX3ent_setcollisionflag(you, NULL,PX_PF_NOTIFY_TOUCH);
kick_vec.x=100;
kick_vec.y=0;
kick_vec.z=0;
vec_rotate(kick_vec,camera.pan);
pX3ent_addvelcentral(you, vector(kick_vec.x, kick_vec.y, kick_vec.z));
you.event=impact_event;
}
it only works in the previous version. (0.85.0)
|
|
|
Re: AckphysX3 development thread
[Re: Emre]
#421050
04/09/13 07:00
04/09/13 07:00
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
Yes, you found the bug I was talking about. NULL is used only for level geometries (level_ent). Here, you are creating a terrain, called terrain_ent. So to enable event between those two entities, you need to change
pX3ent_setcollisionflag(you, NULL,PX_PF_NOTIFY_TOUCH);
to
pX3ent_setcollisionflag(you, terrain_ent,PX_PF_NOTIFY_TOUCH);
In the previous version, event is always called after you used an entity to register for an event, even if the entity is colliding with a different entity.
|
|
|
|