Problem with Bezier Path Creator and Third Person CameraBezier timed animation pathbezier path wideningUnity3D Third Person Controller and AnimationsDetect if third person camera touches cube unity3dHow to find the interval of a constant moviment in a bezier pathChaining a path of 3D bezier segmentsGetting consistent normals from a 3D cubic bezier pathRaycasting for a third person shooterWandering AI in unity C#Visual C# bezier drawing problems

Name These Animals

Why is the Apollo LEM ladder so far from the ground?

If Trump gets impeached, how long would Pence be president?

What do you call a flexible diving platform?

How to access HTML input values from Twig and vice versa

Nested keyval proper parsing

How do I learn to recognise what is worth publishing

Telling manager project isn't worth the effort?

Must a song using the A minor scale begin or end with an Am chord? If not, how can I tell what the scale is?

Why is の所 used after ドア in this sentence?

What is "aligned sequences" and "consensus sequence" in the context of sequence logo? How to compute these?

8086 stack segment and avoiding overflow in interrupts

Can I change the license of a forked project to the MIT if the license of the parent project has changed from the GPL to the MIT?

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

How likely is fragmentation on a table with 40000 products likely to affect performance

Why didn’t Christianity spread southwards from Ethiopia in the Middle Ages?

Introducing Tetronogram!

What's the importance of the plane hijacking to the plot of Suspiria (2018)?

Why is the number of local variables used in a Java bytecode method not the most economical?

Can you place a support header in the ceiling?

Is there an antonym for "spicy" or "hot" regarding food (NOT "seasoned" but "spicy")?

Examples of simultaneous independent breakthroughs

How did the Axis intend to hold the Caucasus?

Why did House of Representatives need to condemn Trumps Tweets?



Problem with Bezier Path Creator and Third Person Camera


Bezier timed animation pathbezier path wideningUnity3D Third Person Controller and AnimationsDetect if third person camera touches cube unity3dHow to find the interval of a constant moviment in a bezier pathChaining a path of 3D bezier segmentsGetting consistent normals from a 3D cubic bezier pathRaycasting for a third person shooterWandering AI in unity C#Visual C# bezier drawing problems






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a really strange problem. I have downloaded a "Bezier Path Creator" https://assetstore.unity.com/packages/tools/utilities/b-zier-path-creator-136082 (code below):



using UnityEngine;
using System.Collections.Generic;

namespace PathCreation

public class PathCreator : MonoBehaviour


/// This class stores data for the path editor, and provides accessors to get the current vertex and bezier path.
/// Attach to a GameObject to create a new path editor.

public event System.Action pathUpdated;

[SerializeField, HideInInspector]
PathCreatorData editorData;
[SerializeField, HideInInspector]
bool initialized;

// Vertex path created from the current bezier path
public VertexPath path

get

if (!initialized)

InitializeEditorData(false);

return editorData.vertexPath;



// The bezier path created in the editor
public BezierPath bezierPath

get

if (!initialized)

InitializeEditorData(false);

return editorData.bezierPath;

set

if (!initialized)

InitializeEditorData(false);

editorData.bezierPath = value;



#region Internal methods

/// Used by the path editor to initialise some data
public void InitializeEditorData(bool in2DMode)

if (editorData == null)

editorData = new PathCreatorData();

editorData.bezierOrVertexPathModified -= OnPathUpdated;
editorData.bezierOrVertexPathModified += OnPathUpdated;

editorData.Initialize(transform.position, in2DMode);
initialized = true;


public PathCreatorData EditorData

get

return editorData;




void OnPathUpdated()

if (pathUpdated != null)

pathUpdated();



#endregion




So it worked really nice, and I liked it. I used it for my tram system. But after it I needed to create a third person camera and I wrote such a code:



using UnityEngine;
using System.Collections;

public class CameraRotateAround : MonoBehaviour

public Transform target;
public Vector3 offset;
public float sensitivity = 3;
public float limit = 80;
public float zoom = 0.25f;
public float zoomMax = 10;
public float zoomMin = 3;
private float X, Y;

void Start ()

limit = Mathf.Abs(limit);
if(limit > 90) limit = 90;
offset = new Vector3(offset.x, offset.y, -Mathf.Abs(zoomMax)/2);
transform.position = target.position + offset;
offset.z -= zoom + 3;


void Update ()

if(Input.GetAxis("Mouse ScrollWheel") > 0) offset.z += zoom;
else if(Input.GetAxis("Mouse ScrollWheel") < 0) offset.z -= zoom;
offset.z = Mathf.Clamp(offset.z, -Mathf.Abs(zoomMax), -Mathf.Abs(zoomMin));

X = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivity;
Y += Input.GetAxis("Mouse Y") * sensitivity;
Y = Mathf.Clamp (Y, -limit, 0);
transform.localEulerAngles = new Vector3(-Y, X, 0);
transform.position = transform.localRotation * offset + target.position;




And after it at first seconds of gameplay everything was nice, but that the camera started to fly away from the tram. I really don't have any idea what to do with it and why it is happening.



The video about flying camera away from the tram is there: https://youtu.be/BXHnvq8bpPM.
Thank you for the help.










share|improve this question



















  • 1





    hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

    – johnny 5
    Mar 26 at 21:13












  • @johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

    – Глеб Буткевич
    Mar 27 at 7:59












  • @ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

    – Dominik Mokriš
    Apr 2 at 20:49











  • @DominikMokriš It didn't help me so much, I found the answer on my next question

    – Глеб Буткевич
    Apr 3 at 6:07

















0















I have a really strange problem. I have downloaded a "Bezier Path Creator" https://assetstore.unity.com/packages/tools/utilities/b-zier-path-creator-136082 (code below):



using UnityEngine;
using System.Collections.Generic;

namespace PathCreation

public class PathCreator : MonoBehaviour


/// This class stores data for the path editor, and provides accessors to get the current vertex and bezier path.
/// Attach to a GameObject to create a new path editor.

public event System.Action pathUpdated;

[SerializeField, HideInInspector]
PathCreatorData editorData;
[SerializeField, HideInInspector]
bool initialized;

// Vertex path created from the current bezier path
public VertexPath path

get

if (!initialized)

InitializeEditorData(false);

return editorData.vertexPath;



// The bezier path created in the editor
public BezierPath bezierPath

get

if (!initialized)

InitializeEditorData(false);

return editorData.bezierPath;

set

if (!initialized)

InitializeEditorData(false);

editorData.bezierPath = value;



#region Internal methods

/// Used by the path editor to initialise some data
public void InitializeEditorData(bool in2DMode)

if (editorData == null)

editorData = new PathCreatorData();

editorData.bezierOrVertexPathModified -= OnPathUpdated;
editorData.bezierOrVertexPathModified += OnPathUpdated;

editorData.Initialize(transform.position, in2DMode);
initialized = true;


public PathCreatorData EditorData

get

return editorData;




void OnPathUpdated()

if (pathUpdated != null)

pathUpdated();



#endregion




So it worked really nice, and I liked it. I used it for my tram system. But after it I needed to create a third person camera and I wrote such a code:



using UnityEngine;
using System.Collections;

public class CameraRotateAround : MonoBehaviour

public Transform target;
public Vector3 offset;
public float sensitivity = 3;
public float limit = 80;
public float zoom = 0.25f;
public float zoomMax = 10;
public float zoomMin = 3;
private float X, Y;

void Start ()

limit = Mathf.Abs(limit);
if(limit > 90) limit = 90;
offset = new Vector3(offset.x, offset.y, -Mathf.Abs(zoomMax)/2);
transform.position = target.position + offset;
offset.z -= zoom + 3;


void Update ()

if(Input.GetAxis("Mouse ScrollWheel") > 0) offset.z += zoom;
else if(Input.GetAxis("Mouse ScrollWheel") < 0) offset.z -= zoom;
offset.z = Mathf.Clamp(offset.z, -Mathf.Abs(zoomMax), -Mathf.Abs(zoomMin));

X = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivity;
Y += Input.GetAxis("Mouse Y") * sensitivity;
Y = Mathf.Clamp (Y, -limit, 0);
transform.localEulerAngles = new Vector3(-Y, X, 0);
transform.position = transform.localRotation * offset + target.position;




And after it at first seconds of gameplay everything was nice, but that the camera started to fly away from the tram. I really don't have any idea what to do with it and why it is happening.



The video about flying camera away from the tram is there: https://youtu.be/BXHnvq8bpPM.
Thank you for the help.










share|improve this question



















  • 1





    hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

    – johnny 5
    Mar 26 at 21:13












  • @johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

    – Глеб Буткевич
    Mar 27 at 7:59












  • @ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

    – Dominik Mokriš
    Apr 2 at 20:49











  • @DominikMokriš It didn't help me so much, I found the answer on my next question

    – Глеб Буткевич
    Apr 3 at 6:07













0












0








0








I have a really strange problem. I have downloaded a "Bezier Path Creator" https://assetstore.unity.com/packages/tools/utilities/b-zier-path-creator-136082 (code below):



using UnityEngine;
using System.Collections.Generic;

namespace PathCreation

public class PathCreator : MonoBehaviour


/// This class stores data for the path editor, and provides accessors to get the current vertex and bezier path.
/// Attach to a GameObject to create a new path editor.

public event System.Action pathUpdated;

[SerializeField, HideInInspector]
PathCreatorData editorData;
[SerializeField, HideInInspector]
bool initialized;

// Vertex path created from the current bezier path
public VertexPath path

get

if (!initialized)

InitializeEditorData(false);

return editorData.vertexPath;



// The bezier path created in the editor
public BezierPath bezierPath

get

if (!initialized)

InitializeEditorData(false);

return editorData.bezierPath;

set

if (!initialized)

InitializeEditorData(false);

editorData.bezierPath = value;



#region Internal methods

/// Used by the path editor to initialise some data
public void InitializeEditorData(bool in2DMode)

if (editorData == null)

editorData = new PathCreatorData();

editorData.bezierOrVertexPathModified -= OnPathUpdated;
editorData.bezierOrVertexPathModified += OnPathUpdated;

editorData.Initialize(transform.position, in2DMode);
initialized = true;


public PathCreatorData EditorData

get

return editorData;




void OnPathUpdated()

if (pathUpdated != null)

pathUpdated();



#endregion




So it worked really nice, and I liked it. I used it for my tram system. But after it I needed to create a third person camera and I wrote such a code:



using UnityEngine;
using System.Collections;

public class CameraRotateAround : MonoBehaviour

public Transform target;
public Vector3 offset;
public float sensitivity = 3;
public float limit = 80;
public float zoom = 0.25f;
public float zoomMax = 10;
public float zoomMin = 3;
private float X, Y;

void Start ()

limit = Mathf.Abs(limit);
if(limit > 90) limit = 90;
offset = new Vector3(offset.x, offset.y, -Mathf.Abs(zoomMax)/2);
transform.position = target.position + offset;
offset.z -= zoom + 3;


void Update ()

if(Input.GetAxis("Mouse ScrollWheel") > 0) offset.z += zoom;
else if(Input.GetAxis("Mouse ScrollWheel") < 0) offset.z -= zoom;
offset.z = Mathf.Clamp(offset.z, -Mathf.Abs(zoomMax), -Mathf.Abs(zoomMin));

X = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivity;
Y += Input.GetAxis("Mouse Y") * sensitivity;
Y = Mathf.Clamp (Y, -limit, 0);
transform.localEulerAngles = new Vector3(-Y, X, 0);
transform.position = transform.localRotation * offset + target.position;




And after it at first seconds of gameplay everything was nice, but that the camera started to fly away from the tram. I really don't have any idea what to do with it and why it is happening.



The video about flying camera away from the tram is there: https://youtu.be/BXHnvq8bpPM.
Thank you for the help.










share|improve this question














I have a really strange problem. I have downloaded a "Bezier Path Creator" https://assetstore.unity.com/packages/tools/utilities/b-zier-path-creator-136082 (code below):



using UnityEngine;
using System.Collections.Generic;

namespace PathCreation

public class PathCreator : MonoBehaviour


/// This class stores data for the path editor, and provides accessors to get the current vertex and bezier path.
/// Attach to a GameObject to create a new path editor.

public event System.Action pathUpdated;

[SerializeField, HideInInspector]
PathCreatorData editorData;
[SerializeField, HideInInspector]
bool initialized;

// Vertex path created from the current bezier path
public VertexPath path

get

if (!initialized)

InitializeEditorData(false);

return editorData.vertexPath;



// The bezier path created in the editor
public BezierPath bezierPath

get

if (!initialized)

InitializeEditorData(false);

return editorData.bezierPath;

set

if (!initialized)

InitializeEditorData(false);

editorData.bezierPath = value;



#region Internal methods

/// Used by the path editor to initialise some data
public void InitializeEditorData(bool in2DMode)

if (editorData == null)

editorData = new PathCreatorData();

editorData.bezierOrVertexPathModified -= OnPathUpdated;
editorData.bezierOrVertexPathModified += OnPathUpdated;

editorData.Initialize(transform.position, in2DMode);
initialized = true;


public PathCreatorData EditorData

get

return editorData;




void OnPathUpdated()

if (pathUpdated != null)

pathUpdated();



#endregion




So it worked really nice, and I liked it. I used it for my tram system. But after it I needed to create a third person camera and I wrote such a code:



using UnityEngine;
using System.Collections;

public class CameraRotateAround : MonoBehaviour

public Transform target;
public Vector3 offset;
public float sensitivity = 3;
public float limit = 80;
public float zoom = 0.25f;
public float zoomMax = 10;
public float zoomMin = 3;
private float X, Y;

void Start ()

limit = Mathf.Abs(limit);
if(limit > 90) limit = 90;
offset = new Vector3(offset.x, offset.y, -Mathf.Abs(zoomMax)/2);
transform.position = target.position + offset;
offset.z -= zoom + 3;


void Update ()

if(Input.GetAxis("Mouse ScrollWheel") > 0) offset.z += zoom;
else if(Input.GetAxis("Mouse ScrollWheel") < 0) offset.z -= zoom;
offset.z = Mathf.Clamp(offset.z, -Mathf.Abs(zoomMax), -Mathf.Abs(zoomMin));

X = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivity;
Y += Input.GetAxis("Mouse Y") * sensitivity;
Y = Mathf.Clamp (Y, -limit, 0);
transform.localEulerAngles = new Vector3(-Y, X, 0);
transform.position = transform.localRotation * offset + target.position;




And after it at first seconds of gameplay everything was nice, but that the camera started to fly away from the tram. I really don't have any idea what to do with it and why it is happening.



The video about flying camera away from the tram is there: https://youtu.be/BXHnvq8bpPM.
Thank you for the help.







c# unity3d bezier






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 19:35









Глеб БуткевичГлеб Буткевич

628 bronze badges




628 bronze badges










  • 1





    hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

    – johnny 5
    Mar 26 at 21:13












  • @johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

    – Глеб Буткевич
    Mar 27 at 7:59












  • @ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

    – Dominik Mokriš
    Apr 2 at 20:49











  • @DominikMokriš It didn't help me so much, I found the answer on my next question

    – Глеб Буткевич
    Apr 3 at 6:07












  • 1





    hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

    – johnny 5
    Mar 26 at 21:13












  • @johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

    – Глеб Буткевич
    Mar 27 at 7:59












  • @ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

    – Dominik Mokriš
    Apr 2 at 20:49











  • @DominikMokriš It didn't help me so much, I found the answer on my next question

    – Глеб Буткевич
    Apr 3 at 6:07







1




1





hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

– johnny 5
Mar 26 at 21:13






hmm seems like the position of the camera is parented to and object which is not bound to the rotation of the train. Just a guess if you let the train go around the track completely its back in the proper spot when it make a full lap correct?

– johnny 5
Mar 26 at 21:13














@johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

– Глеб Буткевич
Mar 27 at 7:59






@johnny5 oh god, after the full lap camera it returning to a normal position. Also I tried to remove camera from tram, but then it started twitching and it's flying away from tram and it's not returning to normal position. Example: youtu.be/INJStzE2hew

– Глеб Буткевич
Mar 27 at 7:59














@ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

– Dominik Mokriš
Apr 2 at 20:49





@ГлебБуткевич Did johnny's suggestion solve your problem? If not, would you mind updating your question?

– Dominik Mokriš
Apr 2 at 20:49













@DominikMokriš It didn't help me so much, I found the answer on my next question

– Глеб Буткевич
Apr 3 at 6:07





@DominikMokriš It didn't help me so much, I found the answer on my next question

– Глеб Буткевич
Apr 3 at 6:07












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365021%2fproblem-with-bezier-path-creator-and-third-person-camera%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365021%2fproblem-with-bezier-path-creator-and-third-person-camera%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴