The Daily Click ::. Forums ::. Klik Coding Help ::. issue with calculation
 

Post Reply  Post Oekaki 
 

Posted By Message

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
23rd April, 2009 at 16:24:26 -


Originally Posted by Sketchy
Nifflas' formula:
Angle = Abs(360*Min(Max(A.y - B.y)+1, 0), 1)-(ASin((B.x - A.x)/Sqr(A.x - B.x) pow 2 + (A.y - B.y) pow 2))+270))

Or, for a version that you can copy and paste straight into MMF (just rename Point A and Point B);

Angle = Abs(360*Min(Max(Y( "Point A" )-Y( "Point B" )+1, 0), 1)-(ASin((X( "Point B" )-X( "Point A" ))/Sqr((X( "Point A" )-X( "Point B" )) pow 2+((Y( "Point A" ))-Y( "Point B" )) pow 2))+270))

Like I said, it's very complicated. You can find this and other useful formulas are in my article "Useful Formulas".


set cam x to X( "player" )+(Cos(directionFromPlayer( "camera" ))*Min(angleFromPlayer( "camera" ), 50))
set cam y to Y( "player" )-(Sin(directionFromPlayer( "camera" ))*Min(angleFromPlayer( "camera" ), 50))

Shouldn't that be the distance from the player, rather than the angle? And also angle rather than the direction? (I thought directions were just 0-31?)
Actually, if you want to exactly replicate your original expression (the one that stopped working), shouldn't it be:

set cam x to X( "player" )+(Cos(angleFromPlayer( "camera" ))*LoopIndex("aim"))
set cam y to Y( "player" )-(Sin(angleFromPlayer( "camera" ))*LoopIndex("aim"))
?



the only problem with doing that is id have to add another loop, because the loop index contains the variables for the aimer thing. id add another loop but according to the internet, they eat up tons of memory. the only reason i have the aimer thing in a loop is because i found a nifty little tutorial that made it so the thing follows walls (instead of going through them).

ill try throwing in the distance from player in that angle calculation and see if it works any better. thanks alot for your help!

edeat: nah, that didnt work, it just sucked the camera object to the player like it was stuck in some kind of warp holemajig. which was cool but that wasnt the intended effect. ill look over your article and see if theres any nifty tidbits i can find.

Edited by Chloe Sagal

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
   

Post Reply



 



Advertisement

Worth A Click