Use Collision/Trigger Volumes without Rigidbody/Physics


#1

Hi PlayCanvas enthusiasts,

Is it possible to use the built-in collision/trigger system without using rigidbodies?

Let’s say I have a plane which moves in a linear way (from left to right) and its altitude is controlled by player touch input. I also have floating obstacles which needs to be avoided. So what’s the correct way of doing collision detection here?

  • 1 - Bad Solution: Dynamic rigidbody on the plane - using forces/torques doesn’t make sense for the required direct controls
  • 2 - Bad Solution: Having a kinematic rigidbody on the plane - can’t use “teleport” every frame, because it makes the plane stutter. Teleport shouldn’t be used every frame
  • 3 - OK’ish Solution: No rigidbodies at all - needs manual collision detection logic. Would be possible since I just need spherical collision, but still feels wrong not utilizing the built-in collision logic
  • 4 - Good Solution: Is there any? :wink:

Any hints appreciated!
Have a great day,
Rene


#2

if you don’t want to use physics , you can use bounding-box /aabb collision.This way u dont need rigidbodies


#3

Hi @esr_esr,

thanks for your answer. So you are referring to Solution 3 - The “Ok’ish” one?


#4

Might be worth testing if any events are fired when a collision component intersects with another collision component. I can’t remember if it does but should quick to test.

Is this a 2D game? If so, it be worth looking at the p2.js integration that Will did. https://playcanvas.com/project/446127/overview/p2js-integration


#5

You can write some functions to detect bounding-box collision of objects automatically .I mean intersection.if it’s 2d p2.js might be used.But this is another library you should learn . you can implement it on playcanvas i think