|
2 registered members (3run, AndrewAMD),
623
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Crash physX
#341689
09/19/10 12:38
09/19/10 12:38
|
Joined: Sep 2010
Posts: 4 Italy
Rik
OP
Guest
|
OP
Guest
Joined: Sep 2010
Posts: 4
Italy
|
Hi... I'm trying to create a small game, but i have some problem with physX. If i use c_move the game work. But if i want to move the entity with physX i have error E1513:script crash in ball(). Can anyone help me? the code: #include <acknex.h> #include <default.c> #include <ackphysx.h> SOUND* sound1 = "sound.ogg"; VECTOR* vector1; function camera_seg(ENTITY* ent) { vec_set(camera.x,vector(-45,0,15)); vec_rotate(camera.x,ent.pan); vec_add(camera.x,ent.x); vec_set(camera.pan,vector(ent.pan,0,0)); } function move(ENTITY* enti)//function that work { if (key_a) my.pan += 10*time_step; if (key_d) my.pan -= 10*time_step; if (key_w) c_move(me,vector(10*time_step,0,0),NULL,GLIDE); if (key_s) c_move(me,vector(-10*time_step,0,0),NULL,GLIDE); } function main() { physX_open(); screen_size.x = 1024; screen_size.y = 768; mouse_mode = 4; level_load("liv_2.wmb"); } action ball()//don't work { pXent_settype(me,PH_RIGID,PH_SPHERE); pXent_enable(me,1); pXent_setfriction(me,50); ent_playsound(my,sottofondo,100);
while (1) { camera_seg(my); vector1.x = (key_cur-key_cul)*10*time_step; vector1.y = (key_cuu-key_cud)*10*time_step; vector1.z = 0; pXent_addtorqueglobal(me,vector1); wait(1); } }
|
|
|
Re: Crash physX
[Re: Rik]
#341690
09/19/10 12:42
09/19/10 12:42
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
most likely, your level has more then 65k polys(update to latest beta to fix)
3333333333
|
|
|
Re: Crash physX
[Re: Rik]
#341728
09/19/10 18:52
09/19/10 18:52
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
if (key_a) my.pan += 10*time_step; if (key_d) my.pan -= 10*time_step; if (key_w) c_move(me,vector(10*time_step,0,0),NULL,GLIDE); if (key_s) c_move(me,vector(-10*time_step,0,0),NULL,GLIDE);
lol you can't do this in a physic entity, take a look at the physics workshop
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: Crash physX
[Re: Rik]
#341776
09/20/10 11:02
09/20/10 11:02
|
Joined: Sep 2010
Posts: 4 Italy
Rik
OP
Guest
|
OP
Guest
Joined: Sep 2010
Posts: 4
Italy
|
i change the code... This is the new... #include <acknex.h> #include <default.c> #include <ackphysx.h> SOUND* music = "sottofondo.ogg"; VECTOR* vector1; ENTITY* ball; function camera_seg(ENTITY* ent) { vec_set(camera.x,vector(-45,0,15)); vec_rotate(camera.x,ent.pan); vec_add(camera.x,ent.x); vec_set(camera.pan,vector(ent.pan,0,0)); } function main() { physX_open(); screen_size.x = 1024; screen_size.y = 768; mouse_mode = 4; level_load("liv_2.wmb"); ball = ent_create("palla_gialla.mdl",vector(-556,-88,-104),NULL); ent_playsound(ball,music,100); pXent_enable (ball,1); pXent_settype (ball,PH_RIGID,PH_SPHERE); pXent_setfriction (ball,50); while (1) { camera_seg(ball); vector1.x = (key_cur-key_cul)*10*time_step; vector1.y = (key_cuu-key_cud)*10*time_step; vector1.z = 0; pXent_addtorqueglobal (ball, vector1); wait(0.1); } } The debug show this error: error E1513 Script crash in main: SYS. The script show the window and play the music... So i think that the error is in pXent_settype.... Any hint??? 
|
|
|
Re: Crash physX
[Re: Rik]
#341780
09/20/10 12:43
09/20/10 12:43
|
Joined: Oct 2009
Posts: 149 Germany
muffel
Member
|
Member
Joined: Oct 2009
Posts: 149
Germany
|
I think I have found your error. You declare the global POINTER vector1. This vector1 is pointing to nowhere. No memory is allocated for this vector1 Now you write in your ball/main funktion to nonexisting/not allocated memory. This causes the crash. How you solve it?? Delete the "*" in your "VECTOR* vector1" line. and the problem of the crash is solved. PhysX has nothing to do with that corrected code
#include <acknex.h>
#include <default.c>
#include <ackphysx.h>
SOUND* music = "sottofondo.ogg";
//////
VECTOR vector1; //////// here was the mistake
//////
ENTITY* ball;
function camera_seg(ENTITY* ent)
{
vec_set(camera.x,vector(-45,0,15));
vec_rotate(camera.x,ent.pan);
vec_add(camera.x,ent.x);
vec_set(camera.pan,vector(ent.pan,0,0));
}
function main()
{
physX_open();
screen_size.x = 1024;
screen_size.y = 768;
mouse_mode = 4;
level_load("liv_2.wmb");
ball = ent_create("palla_gialla.mdl",vector(-556,-88,-104),NULL);
ent_playsound(ball,music,100);
pXent_enable (ball,1);
pXent_settype (ball,PH_RIGID,PH_SPHERE);
pXent_setfriction (ball,50);
while (1)
{
camera_seg(ball);
vector1.x = (key_cur-key_cul)*10*time_step;
vector1.y = (key_cuu-key_cud)*10*time_step;
vector1.z = 0;
pXent_addtorqueglobal (ball, vector1);
wait(0.1);
}
}
Hope you understand my explanation EDIT:funny how complicated you think. Just because he says PhysX is the problem muffel
Last edited by muffel; 09/20/10 12:44.
|
|
|
|