How can i make Gravity-rooms in a marble-race?

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

How can i make Gravity-rooms in a marble-race?

Postby Drachenbauer » Tue Jul 02, 2019 8:11 pm

Hello

I created a little room for my marbles to start:
Marble Room.phz
(6.24 KiB) Downloaded 416 times

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?

Postby Ken3344 » Mon Jul 22, 2019 7:16 pm

You can use this script:
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)=>{}
}

:thumbup:
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?

Postby Drachenbauer » Thu Jul 25, 2019 10:12 pm

I actually have this:

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?

Postby FRA32 » Fri Aug 09, 2019 7:21 pm

A more easy to use version of the same script looks like this:
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


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests