Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 3D Physics Crashing

Author
Message
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 18th Nov 2016 21:22
As well as VR - I want 3D physics in my game. So I thought I'd start slowly and just set my FPSC level up as the static body, before I start adding all the dynamic and kinematic objects for the user to play with.

But as soon as I use Create3DPhysicsStaticBody( ObjID ) the exe crashes.

So as part of my exe initialisation, I create the physics world like thus:

Quote: "//load objects
Create3DPhysicsWorld()
Set3DPhysicsGravity(0,-1,0)

LoadFPSCLevel( "level-1" )"


Then as part of "LoadFPSCLevel()" I load the objects created by FPSC-2-AGK and attempt to set them as 3D Physics Static Bodies, but at that point the exe crashes. As soon as i comment out the 2 physics commands the exe runs. Here's where I load the *.x files and set them as static physics objects:

Quote: "if Lower( Right( filename$, 1 ) )="x"
ObjID = LoadObject( filename$ )
//SetObjectCollisionMode( ObjID, 1 )

Create3DPhysicsStaticBody( ObjID )
SetObjectShapeStaticPolygon( ObjID )

ObjStatic.insert( ObjID )
endif"


Here's my complete FPSC level loading code:



Any help would be appreciated.
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 18th Nov 2016 21:43
Ok - it seems there is a problem with the mesh I'm loading. In the Debug Log i see this:

Quote: "Failed to load object "mesh-6.x" - No meshes remaining in levels.agc at line 117"


Is there anyway of checking if a mesh fails to load? I tried GetObjectExists(), but this returns "1".
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 18th Nov 2016 21:53
Sorted it. If you check for the number of meshes linked to the object, the failing objects return zero, so the following solves it:

Quote: "
if GetObjectNumMeshes( ObjID )>0
Create3DPhysicsStaticBody( ObjID )
SetObjectShapeStaticPolygon( ObjID )
endif"
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 19th Nov 2016 12:52
When call ing Create3DPhysicsStaticBody there is no need to call SetObjectShapeStaticPolygon.
Create3DPhysicsStaticBody by default sets the shape to static polygon.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-09-29 21:29:35
Your offset time is: 2024-09-29 21:29:35