- Home /
Grappling Hook in 2.5d Game
I've been trying to create a 2.5d Platformer with a Grappling Hook. Right now, I haven't been able to get very far. I've searched Unity Answers, the forums, and google to no avail.
var hit : RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast(ray, hit, 15))
{
grappleDirection = ray.direction;
grappleDirection.z =0.0;
hit.point.z = 0;
grappleTargetPoint = hit.point;
print(grappleTargetPoint);
print(hit.point);
Debug.DrawLine(transform.position,grappleTargetPoint,Color.red,5);
}
Right now, my Raycast is probably more suited to a top down game rather than a platformer. It can basically "hit" inside of any object and that isn't what I want. Ideally, I would think, would be to send a Ray out in the direction of the mouse and have the hit.point from that be a target location.
Then, from there, Pull my character towards it. (Or pull light objects towards him). However, I'm using a character controller and I'm not sure how to go about doing that.
Your answer
Follow this Question
Related Questions
rotate character in 2.5D 1 Answer
CharecterController.Move() ignores parents movement 0 Answers
2D or 3D settings for a 2.5D game? 2 Answers
2D 360 degress platformer example needed 0 Answers