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 / Physics Objects Dont work if InstanceObject

Author
Message
OminusPrime
9
Years of Service
User Offline
Joined: 30th Jun 2015
Location:
Posted: 27th Feb 2016 23:47
Hi Everyone

Ive got physics working really well using 3d shapes it seems to handle up to around 700 at the same time . Now I'm moving the physics into a real world situation where objects are created dynamically using INSTANCEOBJECT and a culling system now the system immediately crashes.
Ive done tests and found the problem is caused within AppGameKit 3d engine, the problem is the Physics system doesn't work with Objects dynamically created,.

See demo Code below that demonstrates the error, When Code is run as-is it crashes but when you disable the line with the InstanceObject and Enable the line with the crateobjectbox it works fine.
Only small Apps can have individual objects like this, anything serious will have many instances and quite often a culling system that dynamically adds and removes objects as they are visibility tested.
until this is resolved there can be no physics worlds larger than a small area.

PS also i see Some people are saying that Raycast now works with Scaled Objects but all code tests show that that is still broken. can anyone confirm if this is fixed.

Thanks Any Help or info would be great


// set window properties
SetWindowTitle( "demonstrate crash using InstanceObject and 3D Physics Engine" )
SetWindowSize( 1024, 768, 0 )

// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetScissor(0,0,0,0)

Create3DPhysicsWorld()
Set3DPhysicsGravity(0,-1,0)

CreateObjectBox( 1, 200,20,200 )
Create3DPhysicsStaticBody( 1 )
SetObjectShapeBox(1)


//This is the test object thats going to be used with instanceObject
CreateObjectBox( 1000, 10,10,10 )


for t=2 to 100
//*********************************************
//*********************************************

// here is the problem
InstanceObject(t,1000) //This line crashes the system

// although This line works perfect
//createobjectbox(t,10,10,10)

//*********************************************
//*********************************************

SetObjectPosition( t, random(-20,20), random(-20,20), random(-20,20) )
Create3DPhysicsDynamicBody( t )
SetObjectColor(t,random(0,255),random(0,255),random(0,255),255)

next t


SetCameraPosition( 1, 0,30,-80 )
SetCameraLookAt( 1, 0,10,0, 0 )

do

Step3DPhysicsWorld()
Sync()
loop
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 27th Feb 2016 23:57
Try CloneObject instead of InstanceObject.
OminusPrime
9
Years of Service
User Offline
Joined: 30th Jun 2015
Location:
Posted: 28th Feb 2016 00:33
Thanks ....I did try Clone Object out of Interest , The Physics does work but it creates a complete copy of the original Object over and over which is just not practical when you have many objects in a world its also very slow compared to Instances.
I have a large 3D world that uses Visible Portal culling and adds or removes Object instances on the fly. Static Objects work great but no physics yet,

also note for physics to work in a 3D world all objects walls floors need to also be physical objects STATIC in this case which as it is would also need to be CLONES. not going to happen for anything more than a small world.

I'm hopeing someone has a work around or Maybe someone from The Game Creators can FIX this.

Thks OminusPrime

Login to post a reply

Server time is: 2024-09-29 11:22:38
Your offset time is: 2024-09-29 11:22:38