General Category > General Anim8or Forum

WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)

<< < (14/58) > >>

cre8orexpert:
Sorry, i have no ideas for new tools (Principally for anim8or)  :'(.

davdud101:
Hey there, cre8orexpert. To cooldude234, I'm thinking my ideas are some REALLY tall orders that definetly will have to wait. but...
Soft Body Physics? For cloth, hair, stuff like that? (Or is that something we do manually?)
Perhaps mesh distortion/fragmentation, for things like explosions where objects can actually fly apart at random, of get realistically dented.

I know for a FACT that these things are REALLY big features, not to mention that by no means are they required. What do you think about them?

Water Music:
Sorry, but as you can probably tell I haven't gotten much forum time lately, and also don't have much time now.  But getting the degree of pitch from a 3d vector is pretty easy so I had to take a second to chime in.

Quick terminology, you have point1 -> (x1, y1, z1) and point2 -> (x2, y2, z2) with the vector between them being (x2-x1, y2-y1, z2-z1) which I'm going to call (dx, dy, dz).  "d" is referring to the greek letter delta which just means ("difference in x", "difference in y", diff z").

The length of a 3d vector is L=sqrt(dx^2 + dy^2 + dz^2).  Then you just make a right angle triangle with the vector as the hypotenuse, and dy as the opposite edge from your pitch angle.  Then you can use 2d trig.

Pitch = sin^-1(dy/L)

or Pitch = sin^-1(dy/sqrt(dx^2 + dy^2 + dz^2))

And if you want to get the Yaw, you then ignore the Y component of the vector completely and sort it out with standard 2d trig.

I hope this helps.  I'll try to check back over the next couple of days to see if you need any clarification.

cooldude234:
Right So I got it working, but however it only works on one particular side (the left side relevant to the world), and I was just wonder if in the math there is some way to just make it 360 able (the values of the angles only go from -90 to +90), or would I just have to make a complex if statement and reverse the angles?

And clearly this states that I suck at math :P

Water Music:
Yes, I think I know what is going on there.  I sort of took the calculation of the yaw for granted as it's pretty straightforward on paper, but in computer speak there are a few cases that you need to take care with.  So I have a new formula for you to try out to get your yaw angle that should take care of everything.  I couldn't get it all into one calculation, but this is the most graceful I could get it:

if dx=0 and dz=0 then
   yaw is unchanged from its last orientation
else
   yaw=sin^-1(dx/sqrt(dx^2+dz^2))
if dz<0 then
   yaw=(pi/2)-yaw

The first part is to take care of situations where the yaw component is non-existent:  straight up, straight down, or not moving.  This will require your keeping track of the last position, or building up functions for special cases.  Movement along the y-axis is problematic, so one way to deal with it is to keep anything from being able to move to an angle which is perfectly perpendicular to the ground -> pitch max of 89 degrees.  Otherwise, if pitch exceeds 90 degrees you'll need to invert the yaw 180 degrees and roll the object around its z-axis 180 to get the pitch below 90 again - if you follow.  Best to just not let them get there.

The second part is the best way to calculate the angle without running the risk of getting a DIV0! error at the x or z axis.

The last part is what takes you from a 180 degree angle to a 360 degree one - except in radians, of course.  I couldn't see a way to integrate it into the other calc, so I think you may have to break it out into an if statement as I have done.

edit:  forgot to mention that this will calculate the angle as increasing while rotating clockwise.  If you want it to increase counter-clockwise then replace dx with -dx in the formula.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version