Jump to content

spring arm functionality


photo

Recommended Posts

This is just a camera attached to something with kind of logic?

Shouldnt be that hard to reproduce.

But, yes, sometimes some 'ready-mades' would come in handy. ;) (like for none programmers like me)

 

Edited by werner.poetzelberger
Link to comment
  • 7 months later...

Here's a way I managed a spring arm in C#.

[ShowInEditor]
Node camera, springStart, springEnd;

private void Update()
{
    var from = springStart.WorldPosition;
    var to = springEnd.WorldPosition;
    WorldIntersection raycast = new WorldIntersection();
    World.GetIntersection(from, to, 1, raycast);
    if(raycast.Surface < 0){
        camera.Position = springEnd.Position;
    }
    else{
        camera.WorldPosition = raycast.Point;
    }
}

 

Link to comment
×
×
  • Create New...