Not signed in (Sign In)

Discussion Tag Cloud


Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    Top spin download (BETA):


    Hi guys, I wanted to take a shot at making my own physics engine for nl2. I believe it should be free use for everyone, here's what I have so far (very early, going to be improved of course)

    Currently it only counts horizontal g force, next is vertical.
    • CommentTimeFeb 8th 2015 edited
    Amazing code, cant wait for some great 4D-free spins.
    Looks great, can't wait to use it.
    • CommentTimeFeb 8th 2015
    My wish has come true! Thank you, o Great Coding Genie
    Yeah but what if its not aligned with that axis how will you tackle that?
    ^I'm currently working on that
    • CommentAuthorMGCD
    • CommentTimeFeb 8th 2015
    This is awesome that you were inspired enough to make your own free version. I really appreciate the thought, even if it proves to be too difficult/unsuccessful. Good luck!
    • CommentAuthorcoaster-inc
    • CommentTimeFeb 8th 2015 edited
    ^thats unfair to think that he wont be able to do it... for the amount of things hes accomplished for his age is i think quite astonishing. and the fact hes making it for free and giving it away for free shows that hes in it more for the community, as he always has been from the RCT3 days... given the fact hes shown a video after only working on it for a few hours i think shows amazing promise. just wait till the next update!
    Posted By: coaster-incwow arrogant much or what... thats unfair to think that he wont be able to do it...

    I don't think that's what MGCD is saying lol... he's just noting that if it gets to the point where it's getting really hard to finish (or if he can't finish at all), that Code should still be proud of what he did. I agree with him, this is a pretty massive undertaking and it's awesome to see him giving it a go. I'm interested to see where he takes it next, and I'm sure he will.
    • CommentAuthorMGCD
    • CommentTimeFeb 8th 2015

    As far I am concerned I left a positive comment, that's unfortunate that you took it as arrogant. I thought I was being very appreciative for his effort.
    Codemaster, I hope you didn't see it that way either!
    • CommentTimeFeb 8th 2015
    Posted By: MorganFanMy wish has come true! Thank you, o Great Coding Genie

    Welp. Time to start the cult.
    I'm going to re-code the engine tomorrow, hopefully to make it more efficient.

    EDIT: added GIF
    • CommentTimeFeb 9th 2015

    The talent in this community. Just awesome.

    • CommentTimeFeb 9th 2015
    Whaaaaat..?? That looks AMAZING!
    • CommentTimeFeb 9th 2015
    Code: you are awesome!
    • CommentTimeFeb 9th 2015
    Props to you, Code! Stunning work.
    • CommentAuthorsprog
    • CommentTimeFeb 9th 2015
    This is nuts! Can't wait for the next update Code!

    Redid parts of it:

    Higher Framerate Video
    Seems to be running into the same issue I was having with the lack of precision in calculating the acceleration. As far as I know there's no way to keep it from skipping around like that..

    It seems really good so far, but what's with the weird swinging in the station?

    ^Thats a side affect, currently being worked on.

    Speaking of things being worked on...

    The trains aren't looking too bad.
    • CommentAuthorTOGO Fan
    • CommentTimeFeb 10th 2015
    The wheels look not quite right. Like they are not gripping the rails.
    (The 3 comments including this one and below are invalid)

    Yes, we are aware at how great your script is. Please don't advertise it here.

    Also, I was going for more like this
    • CommentAuthorJAKool
    • CommentTimeFeb 10th 2015
    Yes yes, you work for the industry. You don't have to rub it in everyone's faces. Code is working really hard on his script and he's doing it for free, so don't be such a jerk.
    • CommentTimeFeb 10th 2015
    @coasterlover420 As awesome as your script is unfortunately its not free, or nor do I have any reason believe it ever will be. Don't promote your accomplishments in someone else's thread, its being a huge A-hole.
    • CommentTimeFeb 10th 2015
    That's very cool!
    I hope you can get rid of that "side effect" - I'm wondering what could causes this.
    ^ the rocking in the station is caused by the way the script calculates rotation based on speed and the difference in speeds between 2 points in a given time... when the movement is accelerating and stopping, the calculation is still going but ending up with a 0 and a number, which causes the car to think it needs to spin even though it doesnt... still an amazing accomplishment so far, and those trains are looking great!
    Due to issues coming up, this project is most likley cancelled =(

    Sorry everyone!
    Why? This looked to be amazing once finished
    • CommentTimeFeb 10th 2015
    What happened? I was really interested in this :(
    By making this script I was hurting the work of coasterlover420 and Coaster-Lab. I didn't want that.
    • CommentTimeFeb 10th 2015
    I didn't get to see coasterlover420 post, but Camiel hasn't never been rude to the community. He has always been pretty open to us, and he usually answer every question he can. I'm surprised to see problems here. However, I don't think you should stop working on this Code. Almost everyone in this topic is interested (as always with your projects), and I can't see how you could hurt anyone's work. Of course it's up to you, but I would love to see this finished :)
    Code? Of course you're not hurting our work!! Please continue!! Your issue is not with me :)
    Oh, in that case, the project will be continued.
    Everyone is free do do whatever they want! I would never come between anyone's projects :)
    ^ This.

    Everyone is free to do what they want in a project, and everyone is entitled to their own opinion on those projects, but let's try to avoid pointless conflicts such as this one.

    I'm glad to see that it will be continued, it looks awesome!
    • CommentTimeFeb 11th 2015
    Code, are you serious? You should get rid of those thoughts, always the same. YOU ARE GREAT, KEEP GOING ON.
    How are you calculating the rocking? It should NOT be based on your velocity at a point in time, but rather your acceleration. I'm a cheeky physics undergrad, if you are wanting a hand with actual calculations give me a shout
    • CommentAuthorJetPulse
    • CommentTimeMar 21st 2015
    The problem is that NL only outputs the car's position. Therefore, you have to calculate the acceleration through a double numerical differentiation which requires information from multiple time-steps (frames in this case). So, you calculate velocities based on positions for the current and previous frame...and then calculated acceleration using the current and previous velocity. So although the calculation is based on acceleration, you use the velocity differential to do that. Pretty much what you end up with is a physics calculation that is 1 frame behind simulation which causes some error. It would be nice to see future additions to the scripting engine to output car velocities and accelerations/forces.
    I have G force calculations that work, but no idea on how to make them influence spinning
    The best possible gforce calculations are pretty spastic from experience anyways. The absolute position matrix thing is really in precise or something.
    The way to calculate spinning is to have the acceleration (forces) on the car affect the acceleration of the spinning. Have a dynamic variable that is the absolute rotation for the frame, have another dynamic variable that is the rotational velocity at the certain frame, then have your rotational acceleration variable which is calculated every frame based on the forces acquired from the car, which would relate to the velocity of the car and the radius of the track where the car lies in the current frame.

    As far as acquiring a precise matrix on the track, the method Train.getCarMatrix() acquires the precise matrix at the centerpoint between the rails. The unfortunate part is that using TrackPos.getCenterRailsMatrix() is the method that loses precision (and takes quite a while to calculate). However, there is a way around the precision issue. Say you have two matrices (X and Y). X is the car matrix and Y is the imprecise center rail matrix. Take a vector and make that V, then set the vector to be the difference between the two matrices. From there, take the length of that vector, L, and use it to create a new more precise track position using this: TrackPos.getTrackPositionOnCenterRailsWithOffset(L);
    • CommentTimeMar 21st 2015
    Posted By: TheCodeMasterI have G force calculations that work, but no idea on how to make them influence spinning

    If you want to be super involved, you'd have to make a kinematic and dynamic model of the train by defining the position of the rotation axis and center of mass of the cars. With that knowledge you can solve the equations of motion for the whole system by either using Newton's laws of motion (the centrifugal acceleration on the car will accelerate the center of mass around the rotational axis, much like a lever will turn a linear force into a rotation) or by using Lagrangian mechanics which will solve the whole state of the mechanical system for you, which would be a bit overkill if you ask me.
    Again it's all well and done getting the acceleration per frame ( of which the time difference between each frame should also be taken into account) , the offset of centre of mass in the car itself will play a VERY large part in the "rocking" of the car. If someone gives me some rough measurements of what the ideal zacspin / free spin car is, I could make a rough estimate of a system that'll work for it.
    Hey guys!

    I've been working on it alot and I even managed to make a Top spin with real physics! (its in manual mode atm)

    (Model is owned by Coaster-Inc)

    I even worked on the zacpsin, and i'm pretty happy with it at the moment.

    (ride by JaKool)

    Anyway, I'm hoping to have a beta out soon, but there are still a few kinks here and there that need ironing out but hey, its coming along!

    • CommentTimeApr 24th 2015 edited
    Looks amazing, and I just love how accurate it gets the zacspins rotations. How is it implemented into the script? like is it just as simple as saying "I want this object to be affected by physics", then the script figures it out the swinging from the how the object moves.
    • CommentTimeApr 24th 2015 edited

    For the Top Spin:
    Did you respect only the gravitational force or all the other forces that occur during the ride?
    So can you do rollovers like this one?

    Edit: Do you even have two separate 'physics engines' for both attractions or do you have a basic one?
    Yes, the top spin can roll over ;)

    They are 2 separate engines. One is for coasters the other for flat rides
    • CommentTimeApr 24th 2015 edited
    Can you maybe upload videos of the TopSpin and Zac Spin as I cannot really see the movement on these GIF files.