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 / Having problems with 3D convex shapes

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Oct 2018 21:51 Edited at: 22nd Oct 2018 22:04
Quote: "I have tried to types of convex shapes and if I place a dynamic object directly above they both fail to work"



1:HOOP TOSS The idea is to be able to throw a hoop over a bottle and it should fall down over the bottle


DUNNY TOSS The idea is to be able to throw a ball into the dunny bowl


They both fail when I try and place a dynamic object just above

About
With the hoop toss it tries to get a torus object over a cylinder
With the dunny toss I try to get a sphere object into the dunny bowl

Things ive Tried
SetObjectShapeConvexHull(obj) on the torus and the dunny and the balls

Quote: "Really not sure what is wrong any help would be greatly Appreciated "


The Bottle Object http://users.tpg.com.au/subarpk/bottle2.obj
The Dunny Object http://users.tpg.com.au/subarpk/toilet.obj
The Hoop http://users.tpg.com.au/subarpk/taurus.obj
Quote: "As windows tries to view them in the browser you could copy to notepad and save or save target as should also work"
fubar
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 22nd Oct 2018 22:06
As far as i know....You can only use SetObjectShapeConvexHull() if the object itself is convex

A torus is not convex - its concave


A bucket or basket is not convex either

So these items wont behave properly when simulated

You will most likely have to make these items out of multiple compound shapes. Each compound shape is convex. So the torus would be multiple cylinders making a circle. Then the item simulates properly.

SetObjectShapeCompound()
then
AddObjectShapeCylinder() x 8 times or so....

At least, thats what I think but havent used 3d physics since february so might be wrong.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Oct 2018 23:07 Edited at: 22nd Oct 2018 23:18
Thanks Bengismo im not sure how I would go about doing that
I may have to use something like AddObjectShapeBox( objID, positionVec3, rotationVec3, sizeVec3 ) and
have several collision shapes for one object just not sure where to start with that

For those that would like to test the above code you will need to make a test project
adding the above
hoopToss.agc
toilet.toss.agc


and these think all the needed media is in my first post
main.agc


declarations.agc note these are just copied from the project with other files not needed to test so there may be more variables here than needed
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Oct 2018 00:13 Edited at: 23rd Oct 2018 00:14
Ok so I changed HoopToss function to


and hoping that should work
but when I use world coordinates on my test like below It doesn't seem to work with the positioning as when I set the position beforehand
and setting the vectors with world coords it dont seem to work there prob some math im missing. If I comment out the setobjectposition
command the box addons may work
fubar
puzzler2018
User Banned
Posted: 23rd Oct 2018 15:01
Well done fubarpk - keep all your ideas and inspirations active - they look really good.

Just a pointer though - the torus object is memory expensive ive found on the FPS. unless you made a simpler polygon one.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Oct 2018 15:33 Edited at: 23rd Oct 2018 16:03
Thanks puzzler still trying to work out how to get the collisions to work
with the test code below the setobjectposition messes it up


anyone have any ideas ?
fubar
puzzler2018
User Banned
Posted: 23rd Oct 2018 15:49
Ill have a few tests with it tonight too to see whats happening with collisions on that object - when I was shattering it and using the 3D Physics - I found that ConvexHull shape worked best for that!!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Oct 2018 16:07 Edited at: 23rd Oct 2018 17:57
Thanks puzzler I just edited the above snippet and got it close if I don't use getObjectposition
so the problem must be with the positioning it says in the helpfile to use world coordinates
ie getObjectWorldX and getObjectWorldAngleX but that throws the collisions right off there
must be some calculation needed there in the vectors


Im thinking I need to do something like



But that still aint quite right


Perhaps theres a bug with compound shapes as its not getting the coordinates passed proper
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Oct 2018 18:48
fixed it had to calculate the vectors before set position

fubar
puzzler2018
User Banned
Posted: 23rd Oct 2018 19:24
Nice one!!

Login to post a reply

Server time is: 2024-04-23 06:29:40
Your offset time is: 2024-04-23 06:29:40