How can i make Gravity-rooms in a marble-race?
4 posts • Page 1 of 1
How can i make Gravity-rooms in a marble-race?
Hello
I created a little room for my marbles to start:
Now i want to create a path out of such little rooms, rotated into different directions.
If a marble collides with the walls of one of theese rooms, it should get gravity towarts the round side of this room, to leave it through the gap there.
How do i create this gravity-trick?
I found a way to add permanent velocity to the marbles, if they touch the walls of a room (down pointing rooms just remove this velocity).
Now the marbles travel through all theese rooms, but sadly don´t bounce, if in left, right or upwards pointing rooms...
How can i make them bounce in all directions?
I created a little room for my marbles to start:
Now i want to create a path out of such little rooms, rotated into different directions.
If a marble collides with the walls of one of theese rooms, it should get gravity towarts the round side of this room, to leave it through the gap there.
How do i create this gravity-trick?
I found a way to add permanent velocity to the marbles, if they touch the walls of a room (down pointing rooms just remove this velocity).
Now the marbles travel through all theese rooms, but sadly don´t bounce, if in left, right or upwards pointing rooms...
How can i make them bounce in all directions?
- Drachenbauer
- Posts: 18
- Joined: Thu Jun 20, 2019 5:29 pm
Re: How can i make Gravity-rooms in a marble-race?
You can use this script:
Pi makes the marbles go up. You can change it so they go different directions.
1.5707965 is left.
-1.5707965 is right.
This one should return the gravity to normal.
- Code: Select all
(e)=>{
e.other.poststep = (e)=>{
vel = vel + [ - math.sin(3.1415925), math.cos(sim.gravityAngleOffset)] * (Sim.gravityStrength) * 2 / Sim.frequency
}
}
Pi makes the marbles go up. You can change it so they go different directions.
1.5707965 is left.
-1.5707965 is right.
This one should return the gravity to normal.
- Code: Select all
(e)=>{
e.other.poststep = (e)=>{}
}
Hello my name is Kenlimepie. I'm an Algodoo Enthusiast, and Marble Racer. I run a Youtube channel which is about Algodoo Marble Racing, but I am not afraid to design new ideas in this program. https://www.youtube.com/c/kenlimepie
- Ken3344
- Posts: 53
- Joined: Mon Sep 05, 2016 8:44 pm
Re: How can i make Gravity-rooms in a marble-race?
I actually have this:
this makes the marbles go up, but without bouncing.
Now i changed tho yours, this makes a more realistik looking movement than mine.
Your other littie script is already in use in the down facing bowls.
I also usa an upwards moving-script in my goal-area to get the winner on top of the stack of all marbles.
- Code: Select all
(e)=>{
e.other.postStep = (e)=>{
vel = [0, 4]
}
}
this makes the marbles go up, but without bouncing.
Now i changed tho yours, this makes a more realistik looking movement than mine.
Your other littie script is already in use in the down facing bowls.
I also usa an upwards moving-script in my goal-area to get the winner on top of the stack of all marbles.
- Drachenbauer
- Posts: 18
- Joined: Thu Jun 20, 2019 5:29 pm
Re: How can i make Gravity-rooms in a marble-race?
A more easy to use version of the same script looks like this:
The gravAngle is the angle that the marbles fall in, with 0 being to the right, 90 is up, -90 is down, etc.
- Code: Select all
{
gravAngle := 90;
vel = vel + [math.cos(gravAngle*math.pi/180),math.sin(gravAngle*math.pi/180)+1]/sim.frequency*9.81;
}
The gravAngle is the angle that the marbles fall in, with 0 being to the right, 90 is up, -90 is down, etc.
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests