Pryme8 Posted March 31, 2016 Share Posted March 31, 2016 Ok take this case and scenario. I have some sort of path its length and shape is irrelevant, but it at last has two points, a start and an end. Now I want to take an object, and with and array in the form of keys = [{value,time,easing},{value,time, easing},{value,time, easing} ]; then call it with something like: var followPath = new Object.followPath(keys, args); followPath.start(); Any takers? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 31, 2016 Author Share Posted March 31, 2016 I think ive figured it out, the one thing I need to solve is how would I return the position of a point on a line by percent of the line? ok... kinda got it structured the way I want... now I got a weird bug.http://www.babylonjs-playground.com/#AGOCE#0 when I set the spheres position it flattens it and makes the mesh a circle? huh? Nevermind it was because the y was nan. Now the question is why is it not starting from the start point that I am passing to it? http://www.babylonjs-playground.com/#AGOCE#1 if I comment out the lerp then its where its supposed to be.http://www.babylonjs-playground.com/#AGOCE#2 I dont quite understand why its teleporting back to 0,0,0 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 31, 2016 Author Share Posted March 31, 2016 http://www.babylonjs-playground.com/#AGOCE#3 So removing the multiplication of the percent stopped it from working i guess... gonna figure out a work around but till then, yea this kinda works without the smoothness. Its the starts of a camera Boone system... for the time being i have http://www.babylonjs-playground.com/#AGOCE#5 which works but I want to get it all onto one line instead of 3 for the lerp. I worked out most of this, and made a demo thread. Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 31, 2016 Share Posted March 31, 2016 Just thinking aloud - why won't you use the animation system? http://doc.babylonjs.com/tutorials/Animations Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 31, 2016 Share Posted March 31, 2016 Have you seen @Jerome's rollercoaster http://www.babylonjs-playground.com/#1HH4OJ#13? Quote Link to comment Share on other sites More sharing options...
jerome Posted March 31, 2016 Share Posted March 31, 2016 Maybe could you use these two math objects : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object http://doc.babylonjs.com/tutorials/How_to_use_Path3D Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 31, 2016 Author Share Posted March 31, 2016 8 hours ago, RaananW said: Just thinking aloud - why won't you use the animation system? http://doc.babylonjs.com/tutorials/Animations Hmm, interesting raan. I kinda skipped over that idea, and went right to how I would do it in unity. I think maybe I'll take a look at doing the same thing but with animations and see how tha performs. Do a bench test of my lerp loop vs animations, and I'm gonna go from there. jerome I think the 3D path may be my ticket, I was just looking over it but it seems it automatically can construct distances between points which would be way easier to find points by percentage then. so perhaps a combination of 3D path and animations instead of a custom lerp? Quote Link to comment Share on other sites More sharing options...
jerome Posted March 31, 2016 Share Posted March 31, 2016 yep, the Path3D gives you the distance of each point from the beginning (first point) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 31, 2016 Author Share Posted March 31, 2016 Just looked at your roller coaster example, and learned freezeWorldMatrix, coolness. Also I like how you did the car and handled it's rotation to the track very intuitive. Yea I just mocked this up really fast because I needed a way to more effectively animate my camera on set rails. With the info you guys gave me and the prototype I'll be able to create what I need thank you! I can't wait to see what you guys think of my surface2air middle tutorial I'm sure y'all will spawn tons of ideas. I want to get it done though so I can move on the deploying a custom physics system for a dual blade helicopter. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.