Erratic rockets

Suggestions and feedback pertaining to Project Reality Single Player.
Post Reply
Solid Knight
Posts: 2257
Joined: 2008-09-04 00:46

Erratic rockets

Post by Solid Knight »

So I've been experimenting with getting rockets to fly in a non-linear path. It can be done however there are many issues to take into account which I will discuss.

I used wings (ObjectTemplate.create Wing) to achieve results. I say results because I've yet to get the exact effect I desire.

Things to know:

PhysicsType:
Using a physicsType Point limits the effects of the wings to a great degree. Thus far I've only been able to get it to curve in a particular direction, up, down, left, right. No spiraling, no tumbling, and no zig-zags. I suspect that I can get it to rotate on the z-axis in a very tight roll but it's very hard to tell and I think the rockets do that already.

Using physicsType Mesh seems to allow for more complex movement. I've been able to achieve the spiral effect however the rocket eventually spins out of control and starts flying wildly around towards the end of it's flight. The values you input and the configuration of your wings are much more sensitive than using the point physics type. I suspect that the mesh you use needs to be balanced for flight to some degree. However, I'm not an expert on BF2 flight dynamics. When using mesh your current movement affects the trajectory of the missile. So if you're launching these from a fast moving helicopter the flight path will be slightly different depending on how you move. Of course this depends on how your wings are configured--it can range from completely jacking it up to having minimal effect.

Wings:
You need only the minimal amount of configuration for your wings. I've worked with position, rotation and lift variables exclusively. Also note that like anything else mass, drag and gravity modifiers also impact flight trajectory.

Here is an example (note this doesn't produce the results I'm looking for but should give you an idea of what I'm doing):

Code: Select all

ObjectTemplate.geometry hydra_70
ObjectTemplate.setCollisionMesh hydra_70
ObjectTemplate.mapMaterial 0 metal 0
ObjectTemplate.drag 0.05
ObjectTemplate.mass 70
ObjectTemplate.gravityModifier 0.01
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Point
ObjectTemplate.material 55
rem .......................................................................
ObjectTemplate.addTemplate S_hydra_70_Projectile_Looping
ObjectTemplate.addTemplate left_wing_rear
ObjectTemplate.setPosition -2/0/-0.6
ObjectTemplate.setRotation 0/-6/0
ObjectTemplate.addTemplate right_wing_rear
ObjectTemplate.setPosition 2/0/-0.6
ObjectTemplate.setRotation 0/6/0
ObjectTemplate.addTemplate left_wing_front
ObjectTemplate.setPosition -2/0/0
ObjectTemplate.setRotation 0/-6/0
ObjectTemplate.addTemplate right_wing_front
ObjectTemplate.setPosition 2/0/0
ObjectTemplate.setRotation 0/6/0
ObjectTemplate.addTemplate e_missile_trail
ObjectTemplate.setPosition 0/0/-0.69
rem .......................................................................
ObjectTemplate.timeToLive CRD_NONE/20/0/0
ObjectTemplate.material 55
ObjectTemplate.acceleration 700
ObjectTemplate.maxSpeed 700
ObjectTemplate.damage 200

ObjectTemplate.activeSafe Sound S_hydra_70_Projectile_Looping
ObjectTemplate.modifiedByUser dsu
ObjectTemplate.lowSamples 2147483647
ObjectTemplate.mediumSamples 2147483647
ObjectTemplate.soundFilename "objects/weapons/armament/missiles/sounds/mono/rocket_engine_start_idle.wav"
ObjectTemplate.loopCount 0
ObjectTemplate.is3dSound 1
ObjectTemplate.stopType 0
ObjectTemplate.volume 0.85
ObjectTemplate.pitch 1
ObjectTemplate.reverbLevel 1
ObjectTemplate.minDistance 3
ObjectTemplate.halfVolumeDistance 60

ObjectTemplate.create Wing left_wing_rear
ObjectTemplate.setWingLift 1

ObjectTemplate.create Wing right_wing_rear
ObjectTemplate.setWingLift 1

ObjectTemplate.create Wing left_wing_front
ObjectTemplate.setWingLift 1

ObjectTemplate.create Wing right_wing_front
ObjectTemplate.setWingLift 1
It will fly in a straight line but if you change the z-axis rotation to -90 it should curve to one side.

I'm not sure if anyone has worked with this before but I thought I'd share. Who knows, maybe somebody will be able to figure out how to get a spiral or a wobbling rocket working correctly.

As a note, carefully watch the trajectory of your missile. There have been many times where I thought I had it perfect only to find out that my missile was in a flat spin at 800+ meters when I zoomed in. Use a contrail that allows you to see the flight path clearly.
Last edited by Solid Knight on 2009-01-04 07:20, edited 1 time in total.
Post Reply

Return to “Coop & Singleplayer”