# How to build a physical system like Mario64?

This topic is 4645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am new in developing game.I like Mario64.When i want to produce a game like Mario64, I find it is hard for me to make the character move up to a inclined plane or a pyramid.So i want some math or geometry advice.Thank you.

##### Share on other sites
Take a look at this The plane would be your triangle you are checking collision with and the line would be your current position pointed in the direction of your motion.

##### Share on other sites
I can not see the page.Did you mean that make a collision detection with the
triangle.But how to determine if the point is inside a triangle?

##### Share on other sites
Quote:
 But how to determine if the point is inside a triangle?

This function tests whether any point lies within any arbitrary polygon.
It's definitely not the fastest way, but if works for any polygon, convex or not.
/* (x1, y1) is the segment's start point (x2, y2) is the segment's end point (x0, y0) is the test pointAdd the values of this function for all the line segments in your polygon (don't forget the one for the last vertex to the first) and it will be: 0, if the test point is outside the polygon+1, if it is inside and the order of traversal of vertices is CCW-1, if it is inside and the order of traversal is CWany integer if your polygon has self-intersections*/float WindingNumberOverLineSegment( float& x1, float& y1, float& x2, float& y2, float& x0, float& y0 ){	float	fAtanNominatorAtOne 	= (x0-x2)*(x1-x2)+(y0-y2)*(y1-y2);	float	fAtanNominatorAtZero	= (x0-x1)*(x1-x2)+(y0-y1)*(y1-y2);	float	fAtanDenominator	= x2 *(y1-y0)+x1 *(y0-y2)+x0 *(y2-y1);		return  (atan2(fAtanDenominator, fAtanNominatorAtOne) - atan2(fAtanDenominator, fAtanNominatorAtZero))/(2*PI);}

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632591
• Total Posts
3007250

×