Is there any way to make bots move in a sine wave?
(I actually don't know much about sine, I'm in 8th grade so I haven't taken trigonometry yet, just geometry. Ughh it's boring)
Anyway, I can't find an API for moving an object this x this y and this z. Is there one? I thought there was....
And how do I use sine in javascript? Is it sin(num)?
Yeah, its sin(x).
Some handy stuff
To move an object directly, like you say:
obj.position.move(xAdd,zAdd,yAdd);
Though honestly, I feel it'd be easier to just have a series of controlled turns, to move in a wave. Just thinking about what the sine functions would require... ugh. For the sake of thought though, is this going to be a side scrolling (waving along the x,y axis) or top down (x,z axis)?
If the enemy turned he wouldn't be facing the player :P.
It's a first person shooter

. It's 3d, I'm not sure if I'm using the wave or not, but I might as well try.
And it won't be that hard to script, all I have to do is set a var called xPosition to 0, then move from the sine of xPosition and add the amount moved to xPosition then repeat.
Code:
var xPos=0;
....
obj.motionVector.go();
....
//inside a timer:
xPos=100*sin(xPos)+240;
obj.position.move(xPos,0,0)
Though it might not be 240, I can't remember. I'll look at the book I was reading later when I actually write it.
btw: Isn't funny how you take classes in the order IM, Algebra, Geometry when Geometry is the easiest, Algebra the second easiest, and IM the hardest :P? I guess you need to know stuff from IM to do algebra, and from algebra to do geometry....
I'll try this later, have to do stupid geometry homework now :*(. Geometry proofs are like programs that don't do anything. iow it's to easy, but still takes a while.
Whats IM? And you definitely need algebra stuff to do geometry.
Er... If this is an FPS, the way its presented won't work. Considering that it can only work on the x, and z axes, it will only wave up and down on the x axis. Which'll look dumb. You'll haveta find a formula for the engine to figure out which x and z axis values it needs to move, based on the angle to the player.
If that's not explained right, I'll draw a picture in a bit.
I know what you mean, I thought about this before, I'll make sure it moves on the x axis local to the object and maybe get it to rotate it's feet towards the way it's walking (animation blending in the next beta!! :D)....
I'll make sure the wave looks naturale, like the enemy is trying to dodge your shots/curve the way they are walking, they won't all use the same formula either (I'll use different numbers and stuff to make it look random), it looks dumb when the every single character walks straight at the player.
btw: IM=Investigations into Math [EDIT]You take it OR math B
sin(num here) says sin is not defined :|. Any ideas?
Well thats weird, I took something just called pre-al before algebra.
Yeah, I'd forgotten you just can't have a floating command like that. I don't know. It might be utility dot something, though I don't know what. Brian?
Did you try math.sin(x); ?
Just tried it, doesn't work :|.
Can you do var.sin(var) ?