View unanswered posts | View active topics It is currently Sat May 03, 2025 6:02 pm



Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
 collision shapes tutorial (request) 
Author Message
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
Collisions may look too easy to use and this may be the reason this subject is not covered very much.

But sometimes issues appear that made me reload and test for hours. Some designers like me are not used with this subject specific to game building.
Could you please make a simple tutorial?

Please follow my questions and feel free to add others. I'll gather all the answers.

- which are the best shapes to use as colliders?
- why boxes instead of cylinders?
- can we use custom shapes like tubes for example? Will the inside collide in a good way?
- is capsule a custom shape? I cant find it in maya
- imported shapes into maya work as colliders the same way as maya primitives or do they need any maya tweaks? If so, what are? Should we set the normals for example?
- why an object placed above another gets stuck when falling and in other cases both jump from their place
- is it important to declare the collision shape in .ini files? What is the real meaning of these shapes? What exactly is a LINE shape collider while maya shows a capsule?
- Are the shapes programmed differently due to their shape type in the .ini files? We need this list explained.

Please answer just a couple, I can build this first post as a FAQ.


Tue Aug 25, 2015 1:45 pm
Profile
Site Admin
Site Admin

Joined: Thu Feb 07, 2013 11:16 am
Posts: 1930
Hope this helps:


>> Could you please make a simple tutorial?

You can use the following shape_type's for colliders:

SPHERE (a sphere)
LINE (a round capped cylinder, y-axis direction)
BOX (a box)
CONE (a cone, y-axis direction)
CYLINDER (a cylinder, y-axis direction)

A mesh is needed because that is used to calculate the collision manifold (use google for more info on that).

The shape size is derived from the mesh, so mesh needs to be oriented correctly.


>> - which are the best shapes to use as colliders?

That depends on the object. A chair consists of several boxes. A bottle uses a cylinder. A dildo e.g. can best use a LINE.


>> - why boxes instead of cylinders?

Boxes are most used. They are cheap to calculate collisions for. Fastest is sphere collision, but most objects are better fitted using boxes.


>> - can we use custom shapes like tubes for example? Will the inside collide in a good way?

Only the above shape types are supported. A tube could be fitted using LINE shape types.


>> - is capsule a custom shape? I cant find it in maya

It is a round capped cylinder in Maya. It is the LINE shape type in XSP.


>> - imported shapes into maya work as colliders the same way as maya primitives or do they need any maya tweaks? If so, what are? Should we set the normals for example?

Normals are not needed. Only the polygon mesh shape is used.
Best is to use simple meshes for collision objects. Also see the Wiki Resource Pack for examples.


>> - why an object placed above another gets stuck when falling and in other cases both jump from their place

I am not sure what you mean by this. Do you have an example in the engine where this happens.


>> - is it important to declare the collision shape in .ini files? What is the real meaning of these shapes? What exactly is a LINE shape collider while maya shows a capsule?

Default is BOX, otherwise specify the shape_type.


>> - Are the shapes programmed differently due to their shape type in the .ini files? We need this list explained.

The mesh needs to fit the shape_type. Using a cylinder on a box object does not work correctly.
So when using a BOX you need to have a cube mesh in Maya as well.


Tue Aug 25, 2015 2:24 pm
Profile
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
Wow thanks a lot for this.

I'm sorry I may look like someone asking without searching. I read a few of the above in older topics.
I want to gather info in a single place.

I will process all this later andseeif anything can be added.

In my sool I played with different colliders. I placed 2 components in the aame waypoint, one above the other. One containing a cylinder that was falling into the tube collider from the other part. A tube and an inside cylinder made the parts jump and cubes made them stick. I tried to make the 2 stool parts act like real. Then I published it without these colliders.
I believe a cylinder falling inside a tube will cause flying but as you say, tubes are not supported or the colliders just knocked hard onto each other.

Also if I have a custom low poly mesh, can I declare the same mesh as collider? Are there bad issues regarding this?

I see line and cone are y-axis .... Then the maya models should always respect y-axis? Very important info.


Tue Aug 25, 2015 3:14 pm
Profile
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
@xpadmin please help me on this one. It is regarding a triangle base prism for a wooden pony.

I have tested some unusual colliders recently.

One test was to define a cylinder collider (cylinder can have minimum 3 edges, so a prism is a cylinder, right?

An object like the card is reacting to the collider prism edges but ignored by the 3 prysm faces. However the cap facets are colliding.

I added 3 boxes for each side, in 60 degrees one to each other. Close edges made the interacting object jump away.

Which is the best approach for a prism?
Is it when I put 2 boxes with 2 parralel edges close to each other, they will create a double colliding force causing jumping?

Most important for me: is there a way in game to see if colliders are acting wrong? If I set them up properly or not? Is jumping and flying a clue?


Sun Sep 13, 2015 9:34 pm
Profile
Site Admin
Site Admin

Joined: Thu Feb 07, 2013 11:16 am
Posts: 1930
A cylinder cannot be used to create a prism. The cylinder mesh shape should fit an actual cylinder (round).
Also it is not good to combine boxes inside each other.
Jumping meshes is indeed a sign the colliders are not good.

A mesh type POLYMESH (I forgot that one) can best be used for arbitrary shapes (they have to be convex).
They are however somewhat more CPU intensive. So if you can use one of the base types that is faster.
But for a prism, the polymesh should work.


Tue Sep 15, 2015 9:40 am
Profile
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
Thanks a lot Xpadmin! I tested and fixed my files today.

Btw I think you mean shape_type = MESH (POLYMESH gave me an error so I peeked into the filemaker.exe with a text viewer)


Fri Sep 18, 2015 10:04 pm
Profile
Site Admin
Site Admin

Joined: Thu Feb 07, 2013 11:16 am
Posts: 1930
yes I meant MESH sorry :)


Fri Sep 18, 2015 10:20 pm
Profile
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
I needed a cylinder collider but it acted strange.
I have got 2 identical cylinders but one of them gets an object stuck. (I replaced the chains arms with cylinders, one of the chains gets stuck when I spin its cylinder)

First I imported from Max. It didnt go well.
Then I created the cylinders in Maya. Got the above issue. I think it is seen as a ngonal shape, not a round nice cylinder.

I believe its not very ok to import the colliding mesh but to create in Maya instead.

What to do, make more detailed cyllinder? Does filemaker create its own cylinder and the game sees it as a smooth one, or do I need to create it with lots of side facets?

Hope you understand, I am not sure if I explain it right.

Also, you mentioned the collider needs to be on y-axis. If I need a CYLINDER or LINE on x-axis, do I need to create it on y-axis and rotate it? Or is it ok if I build it on x-axis?
All the tutorial examples are made nicely on y-axis and I'm stuck trying something different.


Sat Oct 03, 2015 11:20 pm
Profile
Site Admin
Site Admin

Joined: Thu Feb 07, 2013 11:16 am
Posts: 1930
@Loki

A cylinder collider shape needs to have y-axis orientation. Best is to use the Maya primitives to create one.
The collider needs to have enough detail but does not have to be triangle based. Best is to merge the top (and then bottom triangles) into one polygon.

For the render part of the cylinder you can use any (also imported) cylinder shape.


Sun Oct 04, 2015 6:26 pm
Profile
Rank 15
Rank 15

Joined: Sun Jun 28, 2015 8:36 am
Posts: 243
I am not using triangle but quad meshes. Or I dont understand what you mean by merging triangles.

For an x axis I rotated a maya cylinder made on y without freezing it.


Sun Oct 04, 2015 7:41 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group.
Designed by X-Moon Productions.