Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (3run, AndrewAMD), 623 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Crash physX #341689
09/19/10 12:38
09/19/10 12:38
Joined: Sep 2010
Posts: 4
Italy
R
Rik Offline OP
Guest
Rik  Offline OP
Guest
R

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:
Click to reveal..
#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 Offline
Senior Expert
Quad  Offline
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: Quad] #341722
09/19/10 18:41
09/19/10 18:41
Joined: Sep 2010
Posts: 4
Italy
R
Rik Offline OP
Guest
Rik  Offline OP
Guest
R

Joined: Sep 2010
Posts: 4
Italy
I have the latest version.... Anything else? frown

Re: Crash physX [Re: Rik] #341728
09/19/10 18:52
09/19/10 18:52
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
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] #341729
09/19/10 18:57
09/19/10 18:57
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Same procedure as every time: reduce the code to a minimum:

action ball()
{
pXent_settype(me,PH_RIGID,PH_SPHERE);
pXent_enable(me,1);
pXent_setfriction(me,50);
}

...and build it up again line by line.
You can compare it to the sample earthball8.c where the ball is created after loading the level within the main function. I guess you placed it in WED in the level? Shouldn't make a difference though.

Is your ball a model (mdl) or a level entity (wmb)? Maybe, that's a problem.

Re: Crash physX [Re: Rik] #341776
09/20/10 11:02
09/20/10 11:02
Joined: Sep 2010
Posts: 4
Italy
R
Rik Offline OP
Guest
Rik  Offline OP
Guest
R

Joined: Sep 2010
Posts: 4
Italy
i change the code... This is the new...
Click to reveal..

#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??? frown


Re: Crash physX [Re: Rik] #341780
09/20/10 12:43
09/20/10 12:43
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

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
Click to reveal..

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.
Re: Crash physX [Re: muffel] #341917
09/21/10 17:39
09/21/10 17:39
Joined: Sep 2010
Posts: 4
Italy
R
Rik Offline OP
Guest
Rik  Offline OP
Guest
R

Joined: Sep 2010
Posts: 4
Italy
Yes.... The error is in VECTOR*...
Thank you so much.... laugh


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