Hi all,
I am looking to implement an arrow pointer in my game. This is basically to point the user to the direction of another entity. How can I achieve this?
Hi all,
I am looking to implement an arrow pointer in my game. This is basically to point the user to the direction of another entity. How can I achieve this?
You should take a look at the lookAt function.
https://developer.playcanvas.com/en/api/pc.Entity.html#lookAt
You can see it implemented in the Information Hotspots sample project where that function is used to keep the hotspots pointing at the camera.
Thanks @wturber. Would you like to help out with game that we are developing? I would greatly appreciate it.
I don’t have the time or the skills. But thanks for the offer.
You’re welcome. Perhaps you could help us with our later games, when we both become better at this…
Perhaps. I just don’t think I’m on a gaming track right now. But I expect to be on this forum for a while, so you can always check in with me later.
Sure. Thanks a lot @wturber
@wturber, this is what happens when I use the lookAt function. Is there a way to get it pointing at me?
change the rotation as well:
https://developer.playcanvas.com/en/tutorials/billboards/
use something like this to get the lookAt the camera:
Also you would still have to change the local rotation (or EulerAngles) to get it to face with the laser end pointing at the player
Can’t get it to work, can you fix it?
Point at points the negative Z axis of the object toward the target. Assuming you have set the target to “you” correctly and the script otherwise functioning right, I’d assume that you don’t have the gun barrel modeled so it is pointing on the negative Z axis. If my assumption is correct, you can fix it one of two ways.
I’ll try that, thanks a lot @wturber