Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-15-2011, 05:59 PM

I don't see how one would be able to find the slope at a particular point in a object in Alice. I'm assuming you want the skateboard to move up AND tilt in the appropriate direction right? If I have time, I'll see if I can do something with a "pool" shape which is what I think is what you are trying to go after. However, if I do it, the cross-sections are going to be circle, not ellipses. The only reason this is going to take a while if I do it, is because I would need to use Calculus to find the corresponding slope of the curved surface.


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 04-15-2011, 09:18 PM

Quote:
Originally Posted by Lordcorvin View Post
Both
well you could just use trig for an incline, but if your looking to do something like a parabola, you could use some calc, such as finding the limit of the equation by doing rieman sum method which would give you the approximation of the area of the ramp, you need to know the equation of the slope to do that though


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-16-2011, 03:48 AM

I was thinking something like finding the slope using differentiation. Like if you wanted to get the shape of a skateboarding pool, you would just find the slope of a upside-down semicircle. So...

x^2 + y^2 = r^2 (Formula of circle)

y = -SQRT(r^2 - x^2) (Solve for y. Take the negative root to get the bottom portion.)

dy/dx = (-1/2)*(r^2 - x^2)^(-1/2)*(-2x) (Differentiate and use chain rule)

dy/dx = -x*(r^2 - x^2)^(-1/2)

Then you just plug in your values for r and x. To get the degrees, you can just go:

arctan(-x*(r^2 - x^2)^(-1/2)) = degrees

Then since Alice is measured in revolutions:

degrees / 360 = revolutions

Now, implementing this in Alice is going to be a lot harder. Btw, let me know if my math was wrong!


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 04-16-2011, 08:33 AM

Yeah I was gonna say, talking about how to do all those math equations are easy, but actual implementation into Alice is actually a lot different. For example how are you going to find the dimensions of everything, you'll have to set dummy objects in places as coordinates to find the lengths of certain things, it would actually be harder to use that type of math for this.

To do the slope collision I think it would be best actually to use my collision detection that I used in my maze game. First you would create a gravity method making you call down at a certain speed when you are too far above the ground (you can look online for gravity math equations if you want it to be realistic), and then make a collision detection for the ground so that you never fall past the ground. Then you make the wall collision that I made, except put it at a slant so that as the skateboarder starts the ascension, the collision detection method for that wall you put on the slope will push him upwards away from it. Then as he leaves the ramp, the wall collision will no longer be in effects and the gravity method will take over and bring him back towards the ground.

Easier said than done of course, there are many specifics to make this work that you'll have to figure out on your own (for example you'll probably have to create dummy objects on each wheel side of the skateboard, both having their own effects with the wall collision and gravity method, allowing you to rotate the skateboard as you go up the ramp, it would look kind of weird to still be standing up straight as you go up a ramp).

EDIT: 950'th post!


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-16-2011, 11:30 PM

The problem is, how are you going to tilt the skateboard at the appropriate angle. The collision detection "moves" the object accordingly but it doesn't tilt it. You would want the skateboard to tilt accordingly as it moves up the ramp or the pool. You wouldn't want it so stay at a flat angle.

Wait, does your collision detection program tilt objects accordingly? If it does, then great! (and just ignore what I said)


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 04-17-2011, 08:28 PM

Quote:
Originally Posted by reuben2011 View Post
The problem is, how are you going to tilt the skateboard at the appropriate angle. The collision detection "moves" the object accordingly but it doesn't tilt it. You would want the skateboard to tilt accordingly as it moves up the ramp or the pool. You wouldn't want it so stay at a flat angle.

Wait, does your collision detection program tilt objects accordingly? If it does, then great! (and just ignore what I said)
Thats why I was saying towards the end of my post before yours that there would be more to think about to make it work. I was offering a possible way in the parentheses where I suggested using dummy objects at each wheel and using individual methods for those making them tilt the skateboard either way depending on where they were in relation to the slope. Its a possible way you could do it, but thats for the programmer to figure out, and I'm not making this program. You could use my collision detection method to help you make the tilting possible though.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-18-2011, 03:22 AM

Well, collision detection with more complicated shapes isn't going to be an easy task for anyone. Lordcorvin, have you tried anything yet?


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
Lordcorvin
Senior Member
 
Lordcorvin's Avatar
 
Status: Offline
Posts: 59
Join Date: Feb 2011
Location: Hogwarts:)
Default 04-18-2011, 03:48 PM

Thanks guys for helping me out
I don't understand the math part yet
And Dameria your collision detection I really liked but unfortunately for slopes it doesn't work good, my alice glitches out when doing so
   
Reply With Quote
Reply

Tags
alice 2.2, collision detection

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.