Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Make rope into a slingshot to launch a sphere
#7
Quote:I decided to launch the ball manually, not by the force applied on it by the rope.

Imho this is a bad idea, as it disconnects the visuals from the actual outcome of launching. Will look weird at best.

(26-05-2021, 05:24 PM)Brainiac Wrote: Then I get the position of the ball in the moment of collision, and set it in initialPosition variable.

The problem is, while the ball is touching the rope, the initialPosition variable is getting the new ball position, so subtracting it by the ball position is resulting in Vector3.zero because both positions are the same.

Do you know have an idea of I can get a launch direction vector while moving the ball against the rope?

It doesn't make much sense to get the position of the ball when it first touches the rope, imho. The user might be able to move the rope to a completely different position after that, and you'd get a really bad estimate of launch direction/strength.

I'd store the ball position in initialPosition every frame as long as rope and ball are in contact (just like you're currently doing). Then when the user releases the mouse button, wait for a frame and get a second ball position. Then your velocity estimate would be (secondPos-initialPos)/Time.fixedDeltaTime.
Reply


Messages In This Thread
RE: Make rope into a slingshot to launch a sphere - by josemendez - 26-05-2021, 05:54 PM