Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Move + attach particle sometimes is offset from the intended move position
#1
Hi,

In my game, you can jump on and swing from ropes. When your rope grab collider hits a particle on the rope, I move that particle to a specific position and then create an attachment (triggered when the rope grab collider hits any particle on the rope):

Code:
// Move the collided particle to the char's hand pos
Vector3 relativePlayerPos = attachedRopeChar.attachTransform.position - solver.transform.position;
solver.positions.SetVector3(particleIndex, relativePlayerPos);

// Create a new attachment and set it to be attached to the character's hand
attachment = obiRope.gameObject.AddComponent<ObiParticleAttachment>();
attachment.target = attachedRopeChar.attachTransform;


This USUALLY works, but about 1/4 of the time there's a small offset between the attach point and the location it was supposed to move to. This seems to happen no matter when I move the particle to the hand, even if it's every frame. Here's a video of the normal correct functionality and also how it looks when it's offset:
https://youtu.be/somDPpYDT6o


I haven't figured out a repro for the issue. Strangely, it seems like on a given playthrough, it either works perfectly every time OR it's offset every time for that entire playthrough. It will randomly then be working or not working again on the next playthrough. This makes me think that there's something about the random starting conditions of the game that's causing it - maybe some Obi's LateFixedUpdate somehow gets out of sync with the timing of the game?

Some other info that might help:
- Obi version 6.5.4
- I'm using Fixed Late Updater with 4 substeps
- Initial attachment is triggered by Solver_OnCollision
Reply


Messages In This Thread
Move + attach particle sometimes is offset from the intended move position - by ShawnF - 05-12-2024, 07:28 PM