Forum Topic: Calculate surface angle

(103 views • 6 replies)

This topic is 1 page long.

<< < > >>
None

Jin

Reply To Post Reply & Quote

Posted at: 8/21/08 06:21 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,926

How do you calculate an angle of a point on a surface? A.S 2

Calculate surface angle

BBS Signature

None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 8/21/08 06:29 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,427

That depends on what the surface is. If it's a bitmap, you'll have to iterate the angle around your point to find two points on the border of the shape and get the normal of the line between them.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Jin

Reply To Post Reply & Quote

Posted at: 8/21/08 06:32 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,926

It's pre-drawn vectors in a movieclip.

BBS Signature

None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 8/21/08 06:43 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,427

Which you can only access as a runtime bitmap unless you use Flashes JSAPI. In which case, get the normal of the segment you intersect?

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Jin

Reply To Post Reply & Quote

Posted at: 8/21/08 07:03 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,926

I still don't get it. If I were to go with the bitmap method, should I specify an angle? Because there aren't any fixed values to access.

BBS Signature

None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 8/21/08 07:20 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,427

What, no. You iterate points around the given in a circle to find two on the border of the shape and get their normal.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Disarray-yarrasiD

Reply To Post Reply & Quote

Posted at: 8/21/08 09:06 AM

Disarray-yarrasiD DARK LEVEL 09

Sign-Up: 11/14/04

Posts: 1,474

At 8/21/08 07:20 AM, GustTheASGuy wrote: What, no. You iterate points around the given in a circle to find two on the border of the shape and get their normal.

you test for collisions in a circle, for example every 10 degrees, and take the average angle of the two farthest border points.

//outline
for(var i=0;i<Math.PI*2, i+=Math.PI/10){
if(_root.ground.hitTest(_x+Math.cos(i)*1 0,_y+Math.sin(i)*10)){
//find border points
}
}
//find average angle

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 03:53 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!