First Problem
-
Flax Collision detection requires a RigidBody/Character Controller,
there is no collision between static Colliders -
RigidBody requires “Simulation” to be enabled, and this will have a Linear (translation) and Angular (rotation) impact/momentum towards the object
-
Not all collisions in the game need this simulation, some of them only need to check simple “hitTest” or a simple movement.
an example case :
Fire projectiles, I don’t need my projectile to have crazy momentum nor do I care how my fireballs are going to rotate when it hits.
To achieve this in current Flax version, this is what I have to do :
A) Set my projectile as Static Collider and make the Target Enemy as RigidBody/CharacterController.
The downside is if my projectile hits the Wall or any other static Collider I can not detect collision, so the projectile will penetrate through the mapB) So my only option is to set my projectile as RigidBody, so my projectile can detect collision with any Collider. But I’m concerned about the performance since I am not going to use all those fancy momentum simulations anyway, I can just write a simple code to move Actor.Position and only need the “OnCollisionEnter()” event in the Collider.
Second Problem
-
RigidBody is hard to control, especially when we want to reduce or disable some simulations
collision-flax-1 - VEED
As you can see in the video, the blue capsule is “CharacterController” and the white capsule is “RigidBody”, the Rigid Body will slide downward when it touches the slope.
I even attached a “PhysicalMaterial with Friction value of 1,000,000,000” to the RigidBody in the video.
And it still slides downward. -
Currently we can lock the rotation, which is useful to prevent the object from rolling around
-
The problem lies in the “translation”, since it will always be affected by momentum.
If you lock the translation, then no collision will occur (it will straight fall through the floor) -
Surprisingly CharacterController does not have this problem and is not affected by momentum.
-
So the only thing I can do to achieve the same result with CharacterController,
is to increase the “Linear Damping” to high value, then write custom code to stop all forces once it touches the floor.
So from what I tested, these are my options if I want to have a collision between objects
-
Use CharacterController for Players and Enemies, which is the intended design.
This is good and there is no problem with it. -
I am confused with how I deal with Non-Character objects, but still want the object to detect collision with the map (Static Colliders)
For example, if you want to make a game like the latest Zelda Tears of Kingdom,
where you move objects realtime in the map to solve puzzles. -
“Kinematics RigidBody” is not affected by momentum and is a good solution, but it does not detect collision with Static Colliders
-
Regular RigidBody is affected by momentum simulation, so it’s hard to predict the exact position to control in an event or puzzle sequences
-
Using Static Collider is not an option, because it will not trigger “OnCollisionEnter” with other Static Colliders.
-
What is the point of separating how momentum work on CharacterController and RigidBody?
Making all of them has a parameter to enable/disable momentum will give more freedom to user. -
Is there something I miss? I am sure the devs have good reasons to make the Collision system as it is,
so It might be me just using the engine in a wrong way? -
Am I supposed to use “CharacterController” for all of the objects I mentioned above?
Suggestions
-
Instead of forcing the user to use specific class for specific feature,
so like use “kinetics” for this, but for that use “RigidBody”, however for anything else use “Collider” , etc
It will lead to confusion for beginners on how to use the feature = hard to learn -
Also by making things specific, it’s hard to please everyone like the problems I mentioned above where there will be someone or some game that requires a combination of features, and separating it into different objects will make it harder (if not impossible) for these users.
This is also why I personaly think Unreal concept of separating features like Actor, Pawn, Character, etc is a terrible idea. -
So in my opinion, if possible you can try to make a simple single “Collider” but with ALL the features that RigidBody, etc has.
Then in each objects inspector parameters, simply allow the user to enable/disable the feature they need or don’t need. So we can have a RigidBody with the momentum turned off for example. And allow ALL Colliders to trigger Collision detection, so there is no need to separate Static or RigidBody.
Thanks.