Two entities of two markers can to have physics?
Well, the problem is that, with PlayCanvasAR, the camera always remains static (at the world space origin) and the markers are positioned relative to the camera. So it’s hard to be sure what you should set for a gravity vector.
However, if you are confident that your marker will be placed on a horizontal, flat surface, you can assume that gravity should be set to:
var gravity = markerEntity.up.clone().scale(-1);
But, yes, it should be possible to use physics in conjunction with AR markers.
I have been trying to move an entity in an AR project with the
rigidbody.applyForce() function to no success. I am getting errors when using the function in the project. I am using the demo AR Playcanvas project.
I have applied collisions and dynamic rigidbody to the entity but just get errors when I try to move the entity using physics. Am I missing something?
What errors are you getting? Can you share a link to a scene showing your problem?
Here is the link to the editor https://playcanvas.com/editor/scene/749721.
The error I’m getting is shown below
And here is the line of code that is throwing the error (line 888)
I had actually asked this question in a different post which you can find here
Thanks for the help!
The entity that you have attached the script to doesn’t have a rigidbody hence it’s null/undefined.
I have attached rigid body and collision to the orange cube.
Okay I fixed that previous error but the object is not being affected by any force that I apply to it.