Sample Code #5 - Authoritative Lag Shooting Issue

MachoBearPandaSavage
edited October 2020 in Photon Bolt
Hello, I am new to Bolt and pretty new to Unity. When I setup the tutorial my shot originates from what appears to be 0,0,0 and I see the shell hit the underside of the terrain and the steam line is drawn out from under the map. The "bullet" still goes where it is aimed, however I can't figure out how to adjust where the shot originates from. Can anyone help? Again this is a project setup using the "5 - Authoritative Lag Shooting" Sample project.

Comments

  • Hello @MachoBearPandaSavage ,

    Are you having issues with the Hit not being registered or similar?

    Bolt performs some internal trickery to perform the raycast checks, as they are transposed to the 0,0,0 origin in order to be performed against other colliders, but this happens just to simplify the math behind the tests.

    There should be no problems using the Ray's origin that you pass to the query along with the Hit info that is returned from the Physics system in order to calculate the bullet trajectory and hit point, for example.

    --
    Ramon Melo
    Photon Bolt Team
  • Hello Ramonmelo,

    I did some debugging and for some reason my muzzleflash.position is not following the weapon:

    var trailGo = GameObject.Instantiate(trailPrefab, muzzleFlash.position, Quaternion.identity) as GameObject;
    var trail = trailGo.GetComponent<LineRenderer>();

    I have it assigned to the script attached to the weapon but it does not seem to be updating. I THINK this is my issue, but I don't know how to fix it. I did replace the rifle with my own object "a crossbow" so I am sure that has something to do with it. Any advice on how the demo updates the muzzleflash.position would be helpful. I'll keep digging in the meantime. This has been a great learning exercise so far. Which is why I am doing this. :smiley:
  • Hello @MachoBearPandaSavage ,

    You need to check where your "muzzleFlash" object is, maybe position it relative to your new weapon.

    That is not really Bolt related, so, take a better look at your hierarchy and you should be able to find the issue.

    Have a nice day.

    --
    Ramon Melo
    Photon Bolt Team
  • MachoBearPandaSavage
    edited October 2020
    Hello Ramon,

    Since this is the tutorial code I was hoping you guys would have the answer. I agree it is my issue though. :D I know I assigned the muzzleFlash to the script which is attached to the CrossBow (not rifle) which I am using. Not sure if that is all I need to do though or if there is another script I am missing somewhere. I will keep digging.

    Thank you,

    MachoBearPandaSavage
  • Hello Ramon,

    Now I realized you did answer my question. Ha! Once again, I am still just starting to learn.

    Thank you for your help with this!

    -MachoBearPandaSavage