Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Camera Follow Custom

Discussion in 'Editor & General Support' started by iamfeyre, May 28, 2016.

  1. iamfeyre

    iamfeyre

    Joined:
    May 20, 2016
    Posts:
    56
    ok what i want to do is really complex... and im new... well its complex cause i dont know how to do it hehe... so here it goes -

    What I Have - Bike and Road (With Walls)(Mesh)

    What i Want to Do -

    1) The Camera must follow a 'SPECIFIC' portion/path of the 'ROAD'...

    2) But, It has to be behind the bike a certain distance at all times..

    Explaining a little more clearly - the camera has to follow the bike as it accelerates, but its focus should be on the road, ie, the camera FOLLOWS the BIKE, but TURNS / change angles with the ROAD....

    How am i supposed to do that??

    I LV U ALL :):):):):)
     
  2. Deleted User

    Deleted User

    Guest

    Make the camera follow the bike but interpolate the rotation based on the roads spline.

    Didn't make the road with a spline? Create a path script with spots you can place around the road rotate the points and keep the rotation based on the rotation between the 2 points. The last can be issued for AI target points too.

    It is a bit complex lol
     
  3. iamfeyre

    iamfeyre

    Joined:
    May 20, 2016
    Posts:
    56
    @J_Emme the road is a mesh...

    1) What is interpolate?? and how do i do that??

    2) i didnt understand those 'points' u want me to place... what are those?? and how do i place them??

    im newbie... plz help me :):)

    I LV U :);)
     
  4. Deleted User

    Deleted User

    Guest

    Whatch this:



    Use this to keep between rotation:

    http://docs.unity3d.com/ScriptReference/Quaternion.Slerp.html

    And this but rotate the points to face the direction of the road so you can keep the rotation:
    http://gamedevelopment.tutsplus.com...eering-behaviors-path-following--gamedev-8769


    This is all just theoretical you will have to do the implementation maybe someone on here has done something like this before? Incase people don't get what you want, Ever seen Mario 64 on n64? They have a camera that follows Mario but if you get to a cornor the camera auto rotates to show the path
     
  5. iamfeyre

    iamfeyre

    Joined:
    May 20, 2016
    Posts:
    56
    @J_Emme Thank You So Much !! ;);)

    No i havent played mario but i saw something like this in Road Rash, and im trying to make a game like that :):) So Thank You !!!!!
     
  6. Deleted User

    Deleted User

    Guest

    ah, okay i just looked up road rash i haven't heard of it you see ha. yeah the camera is simply moving along a spline, watch the video to learn how to make bezier curves and just make one for the camera to fly through. The rotation can match the tangent line of the curve, it might be worth getting a math book such as:
    https://www.amazon.co.uk/Mathematic...1464531276&sr=8-1&keywords=mathematics+for+3d

    that book is pretty hard core though but if you go at it you will do it :)

    This could be useful for implementation if you just want to do code and not bother with math:
    http://catlikecoding.com/unity/tutorials/curves-and-splines/

    That would be the modern implementation in a full polygonal engine (basically unity 3D rather than unity 2D) because road rash is fake 3D.

    http://www.extentofthejam.com/pseudo/