Make a new point in a line I have made with a shape painter?

How do I…

"How can I create a new point in a line that I’ve drawn using the shape painter? I’m trying to create a grapple hook mechanic and I can’t seem to figure out how to create a new point in my existing line.

You can use XFromAngleAndDistance(angle,distance) and YFromAngleAndDistance(angle, distance) to get the next points.

Example:

I think you also might be able to use the bounding box values from the target shape. Like bounding box left, bounding box bottom. You could add an offset so it wouldn’t be on the object. You could base the corner on the direction of the player or nearest side. Raycast might also be useful.

Alright, thank you! This is indeed helpful.

1 Like

You’re welcome. It’s an interesting concept. I want to play around with it. Picking the block and the correct corner seems tricky. I’m thinking of testing it by placing a guide object on each corner of the nearest block using nearest object from the player. If you use a Boolean variable or delete the object then you could filter it out and use its x,y as a new reference point for the next point.

The bounding box technique works. IDK that you would need to create objects but it’s easier and I like the visual. It would require more logic like comparing the player direction and the x positions. You would ignore the bottom point if it was on the right of it.

Try me: the player is draggable.

This just uses 1 box.

1 Like