I need help making an object move towards the player while it is not being looked at by a camera. If possible, I would like the code and a short “tutorial” on how to implement it into my game. I am trying to make a horror game where you are being pursued by Monsters that try to kill you with a short and simple jumpscare. The main objective of my game is to figure out what happened to a family that went missing in a field. You are a detective that tries to figure out what happened to them. Thanks if you see this. Thank you even more if you can help me (as I’m a beginner to PlayCanvas) and have a good day.
The game in question is “HELL”.
Hi @Vincent_Cox and welcome!
This depends on the setup of your game. For example, do you use dynamic rigidbodies or kinematic rigidbodies?
For my setup of my game, I use Dynamic Rigidbodies.
If you need more details, here’s the link to the game, you can check out the editor from there.
The easiest way is to use
lookAt to set the entity in the right direction. Because your entity has a dynamic rigidbody, you need to use a child entity for this. After that you can apply a force on the rigidbody of the parent entity based on the forward direction of the child entity.