Ben Parry
Ben Parry

Reputation: 35

How to add Player Object Collision for aframe?

I have done lots of research trying to find what I can on object collisions within aframe. Other than object on object collisions, I haven't found anything.

Is there a way of producing player on object collisions within aframe, and if so is there a way of making a player object?

Upvotes: 0

Views: 313

Answers (1)

Piotr Adam Milewski
Piotr Adam Milewski

Reputation: 14655

If you have a way of detecting collisions (aabb detection, physics system) then you should add a collision mesh to the camera, and treat your player like any other object. The simplest way of adding a mesh to detect collisions would be adding a child object to the <a-camera>:

<a-camera myCollisionDetector>
  <a-sphere></a-sphere>
</a-camera>

fiddle here (check out the console).

Upvotes: 1

Related Questions