Laser Shooting from off screen

I am very new to game dev but I am trying to get my laser to shoot from the pink craft. On my editor it initially shoots from the correct position but when I hit space to shoot it is shooting from somewhere off screen.
Here is the link to my build.
Thanks for any help.

Hi @Ashley_Solano and welcome,

Are you able to share some of your laser shooting code or even better a public project?

Looking at the minified code,

InputHandler.prototype.update = function(t) {
    if ( && this.entity.translate(.1, 0, 0), && this.entity.translate(-.1, 0, 0), && this.entity.translate(0, 0, .1), && this.entity.translate(0, 0, -.1), {
        var e ="PlayerLaser").resource.instantiate()
          , a = this.entity.getPosition()
          , s = new pc.Entity;,
        s.translate(a.x + 1, a.y, a.z),

It looks like you translate it one unit on the X axis after creating the entity so its one unit to the right of whatever entity this script is attached to

It looks like you

Thank you, I tried removing the + 1 and it is still doing the same thing.

So sorry, I thought the link was for the publish project it says I need premium to make it private and I published the project to PlayCanvas so not sure why is isn’t showing that way. (new to PC)

I don’t think you need the translate at all, or you intended it to be moved to be in front of the ship?

Did you mean to entity.setPosition(position.x, position.y, position.z) instead?

Can you provide a link to the project dashboard please so people can look at the project setup and code? Eg

I would like it to shoot from the ship.

Forked project example:

Main changes:

  • Created an offset from the ship to place the spawned laser
  • Changed the light on the laser to a Omni light as it’s much cheaper than the directional light that was on it
  • Disabled shadows on clustered lights in rendering settings to save startup performance
  • Made the lasers destroy themselves after 5 secs
  • Made the lasers go in the direction they are facing

Wow thank you so much! I updated my original and see a huge difference! Thank you so much! I appreciate your time!