Drag back, aim and shoot with orbitcamera.js

Hi guys,

I’m trying to make a simple soccer game while learning playcanvas. I am using orbitcamera.js and I want user to be able to drag back aim and shoot for the goal with orbitcamera.js.

I found this thread but it doesn’t work with orbit camera it rotates the camera.

How can I achive this? Thanks in advance.

Hi @muratg and welcome,

The orbit-camera script is targeting a singe point in space, I am not sure it’s the best fit for what you are describing.

If you would still like to use this script for your camera movement: one idea is the moment the user clicks/taps to start the drag, disable the orbit camera input and start moving/dragging the ball.

You can do that using the input event handlers Playcanvas provides and add a cumulative force to the ball that will kick it forward.

A good place to start:


1 Like

@Leonidas thanks for the quick reply.

How can I detect the touch/tap on the ball? Can I use the entity picking example?

Yes! The entity picking examples help on that:


Hİ again @Leonidas thank you I used that example to select the ball but I cannot disable and enable orbitcamera.

How can I do that?

I managed to do that now I’ll try to draw a line for aim and calculate force then shoot

1 Like