jungaboon / Tutorial_Scripts

A collection of scripts for my tutorials
MIT License
13 stars 2 forks source link

Gun model is stuck in recoil position #1

Open DriftWare07 opened 8 months ago

DriftWare07 commented 8 months ago

I coded the script by hand while watching your video and ran into this issue. I copied the script straight off of the repo, but i still have the same problem. image i'm not sure why this happens. the recoil script is running from a scene childed to the weapon holder node. Any help would be appreciated.

jungaboon commented 8 months ago

Hi, is the target_object assigned to the correct object in the Inspector? image

I just tested it out on a fresh project and it seems to work fine. Here's my Node setup: image

The Weapon Base is just an empty Node3D that acts as a holder for the Weapon Mesh itself. On the Recoil Handler script, I assign the Target Object as the Weapon Mesh: image

Try setting the Lerp Speed to around 10 and then tweaking the values from there.

DriftWare07 commented 8 months ago

image the meshinstance3d holds the recoil script, and the target object it set to itself, however.

DriftWare07 commented 8 months ago

I think i fixed it. The beginning and end of the curve weren't set to 0

DriftWare07 commented 7 months ago

I'm stuck again on this. It seems like the model won't return to it's previous position again. I have all my curves starting and ending at zero, but my models still end up way past where they originally started. image gunmesh holds the script, and it's straight from the repo, without any edits.

this is my recoil curve image

the model starts here before the recoil is applied: image but it ends up way out here and never returns to it's initial position image i have no idea what's going on, any help would be appreciated.

DriftWare07 commented 7 months ago

i partially fixed it by having the model be a child of the node that has the recoil script, but it's still janky if the value descends below -1