Antenna Physics
Blitz3D Forums/Blitz3D Programming/Antenna Physics
| ||
Hi, im writing a game that uses a radio remote control, the car has one, but when it moves, the antenna looks ridgid and doesnt move like a normal antenna, i have mad a start on my own, but its limited because it only works in the Z motions the program uses Speed startPiv = createpivot(car) topPiv = createsphere() as you can see StartPiv is fixed to the car, and TopPiv is controlled by Speed * (last known location of car) but its doing only working in the Z motion |
| ||
post some more code and it'll be easier for us to see the problem |
| ||
there isn't much code. just need some sugguestions and some sample codes? |
| ||
how about having a force for your car (x,y,z), and a force for your aerial (x,y,z)depending on the differences in force then (make sure the rotation occurs at the bottom, where it is joined to the car) rotate it accordinglyRotateEntity aerial,force_z-force_aerial_z,0,force_x-force_aerial_x all the while slow adjusting the forces so the aerial forces catch up with the car forces. |
| ||
[cheap version] have a twop frame animated .b3d. have it transition between frames of "being blown" and stopped [/cheap version] [easy version] Well, looks like you were on this before, but have a top joint and a bottom joint, and have the top joint follow the motion of the car. then align to vector the antenna to point towards the top joint. [/easy version] [hard version] how about having the antenna be a boned model. then move each pone to the position of the bone below it, and the bottom bone is connected to the car. [/hard version] [harder version] Use some simple verlet physics with a similar boned scheme as outlined above [/harder version] I personnaly would recomend the harder version, but that's just because I'm working on a verletlib, and it all seems easy to me. Heck for the harder version you could just have a couple arrays of vectors, and have a couple of functions set up and run. |
| ||
Actually the little known SetAnimTime command is perfect for the "cheap version" bot builder suggests. You set two keyframes at the extremes (ie. completely upright and completely curled over) and then use SetAnimTime based on the speed of the car to go to specific interpolated positions between those extremes. I suppose you'd actually want three keyframes, for curled over in one direction, completely upright, and curled over the other direction. Thus you can also have the antenna react to sudden stops and moving in reverse. |
| ||
the anim version looks promising.. tho its a bit limited for ALL movements :( i'll give it a blast |
| ||
yeah. then you could rotate the antenna to point the proper direction when the car is turning. |
| ||
well, im having the next problem now, the pointing entity! keeps sticking upright, even as the car rolls < - > |
| ||
ah, well, isn't your antennae parented to the car? |
| ||
nope, i think i got what i needed, tho its abit stickie upie, but its working like one, id like it to wobble too, but theres too much maths, my head cant cope with it! Cheers guys! |
| ||
make the antenna as b3d... and animate the bone with mathematical way - arghh i dont even know what im trying to say |
| ||
get a target anim variable IE destination. then take the target subtracted by the currentt,and multiply it by like .1. then add that value to your current time. finally, add a bit of randomness in. this might sound like it'll be jerky, but I think the smoother above should handle it. You could also add a wobble with a sin function. simply take sin(time)*speed+currentanim. |