Bullet Deceleration

Making or wanting help making your own asset? Check in here
M42 Zwilling
Retired PR Developer
Posts: 613
Joined: 2012-06-10 11:27

Re: Bullet Deceleration

Post by M42 Zwilling »

[R-DEV]J.F.Leusch69 wrote:interesting thing about the deceleration of rockets...
Here's my current SA-7 missile code. It still needs some tweaking as I suspect the force will stop the missile long before it can time out.

Code: Select all

rem *** Generated with Bf2Editor.exe [created: 2006/5/15 11:52]
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
ObjectTemplate.activeSafe GenericProjectile sa7_missile
ObjectTemplate.creator PHO-1 :p ho
ObjectTemplate.modifiedByUser "M42Z"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.createNotInGrid 1
rem ---BeginComp :D efaultCollisionComp ---
ObjectTemplate.createComponent DefaultCollisionComp
ObjectTemplate.collision.hasCollisionEffect 1
rem ---EndComp ---
rem ---BeginComp :D efaultDetonationComp ---
ObjectTemplate.createComponent DefaultDetonationComp
ObjectTemplate.detonation.explosionMaterial 53
ObjectTemplate.detonation.explosionRadius 45
ObjectTemplate.detonation.explosionForce 10
ObjectTemplate.detonation.explosionDamage 500
ObjectTemplate.detonation.endEffectTemplate e_exp_air
ObjectTemplate.detonation.useMMOnEndEffect 1
rem ---EndComp ---
rem ---BeginComp :D efaultProjSoundComp ---
ObjectTemplate.createComponent DefaultProjSoundComp
rem ---EndComp ---
rem ---BeginComp:SeekClosestTargetComp ---
ObjectTemplate.createComponent SeekClosestTargetComp
ObjectTemplate.seek.targetType TTHeat
ObjectTemplate.seek.trackingDelay 0.02
ObjectTemplate.seek.maxAngleLock 1.9
ObjectTemplate.seek.maxDistLock 3700
ObjectTemplate.seek.directionBonus 0.2
ObjectTemplate.seek.reLockTime 30
rem ---EndComp ---
rem ---BeginComp :D efaultFollowComp ---
ObjectTemplate.createComponent DefaultFollowComp
ObjectTemplate.follow.maxYaw 150
ObjectTemplate.follow.maxPitch 150
ObjectTemplate.follow.changePitch 3
ObjectTemplate.follow.changeYaw 3
ObjectTemplate.follow.minDist 10
rem ---EndComp ---
rem ---BeginComp :D efaultPenetrateComp ---
ObjectTemplate.createComponent DefaultPenetrateComp
ObjectTemplate.penetrate.allowSolidPenetration 1
ObjectTemplate.penetrate.allowLiquidPenetration 1
rem ---EndComp ---
ObjectTemplate.geometry sa7_missile
ObjectTemplate.setCollisionMesh sa7_missile
ObjectTemplate.mapMaterial 0 missile 0
ObjectTemplate.drag 1
ObjectTemplate.mass 9.8
ObjectTemplate.gravityModifier 1
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Point
ObjectTemplate.collisionGroups 8
ObjectTemplate.material 53
rem -------------------------------------
ObjectTemplate.addTemplate S_sa7_missile_Looping
ObjectTemplate.addTemplate sa7_missile_force
ObjectTemplate.setPosition 0/0/1.8
ObjectTemplate.setRotation 180/0/0
ObjectTemplate.addTemplate e_averagemissile_trail_aa
ObjectTemplate.setPosition 0/0/-0.95
rem -------------------------------------
ObjectTemplate.timeToLive CRD_UNIFORM/14/17/0
ObjectTemplate.material 53
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.damage 100
ObjectTemplate.acceleration 300
ObjectTemplate.maxSpeed 430
ObjectTemplate.armingDelay 0.6
ObjectTemplate.startDelay 0.3

ObjectTemplate.activeSafe Sound S_sa7_missile_Looping
ObjectTemplate.modifiedByUser "M42Z"
ObjectTemplate.lowSamples 2147483647
ObjectTemplate.mediumSamples 2147483647
ObjectTemplate.soundFilename "objects/weapons/armament/missiles/sounds/mono/rocket_engine_start_idle_high.wav"
ObjectTemplate.loopCount 0
ObjectTemplate.is3dSound 1
ObjectTemplate.stopType 0
ObjectTemplate.volume 0.8
ObjectTemplate.pitch 1
ObjectTemplate.reverbLevel 1
ObjectTemplate.minDistance 10
ObjectTemplate.halfVolumeDistance 50

ObjectTemplate.create ForceObject sa7_missile_force
ObjectTemplate.createdInEditor 1
ObjectTemplate.modifiedByUser "M42Z"
ObjectTemplate.createdInEditor 1
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.constantForce 20
ObjectTemplate.startDelay 2.5
Arnoldio
Posts: 4210
Joined: 2008-07-22 15:04

Re: Bullet Deceleration

Post by Arnoldio »

Arent the current missiles programmed to accelerate? Is it possible to do acceleration and then delayed decceleration?
Image


Orgies beat masturbation hands down. - Staker
M42 Zwilling
Retired PR Developer
Posts: 613
Joined: 2012-06-10 11:27

Re: Bullet Deceleration

Post by M42 Zwilling »

Arnoldio wrote:Arent the current missiles programmed to accelerate? Is it possible to do acceleration and then delayed decceleration?
It looks like it. They come out of the weapon at muzzle velocity, then accerlate at the rate provided by ObjectTemplate.acceleration until their speed reaches the value set by ObjectTemplate.maxSpeed. Currently, they continue at this speed until they time out. However, I added a ForceObject (which obviously enough exerts force) in front of the missile, and rotated it so it is facing towards the missile. When activated, the force it exerts on the missile slows it down until it reaches a speed of zero, at which point it appears to reverse straight up into the sky. The time out time should be tweaked so the missile disappears before this happens. ObjectTemplate.startDelay specifies the time in seconds before the ForceObject activates. This should be set to the missile engine's burn time.
Arnoldio
Posts: 4210
Joined: 2008-07-22 15:04

Re: Bullet Deceleration

Post by Arnoldio »

Possible to end ForceObject at the time the rocket stops? Or maybe delay ForceObject so it ends when the missile dissapears? I dont know the actual weapon data though.

ObjectTemplate.constantForce 20, is there a value of nonlinear force avaliable? That could come in handy... maybe.
Image


Orgies beat masturbation hands down. - Staker
M42 Zwilling
Retired PR Developer
Posts: 613
Joined: 2012-06-10 11:27

Re: Bullet Deceleration

Post by M42 Zwilling »

Arnoldio wrote:Possible to end ForceObject at the time the rocket stops? Or maybe delay ForceObject so it ends when the missile dissapears? I dont know the actual weapon data though.

ObjectTemplate.constantForce 20, is there a value of nonlinear force avaliable? That could come in handy... maybe.
Since the force is attached to the missile, it will go away when the missile does. I don't know of any way to stop the force once it has started. Even if I did, the missile would most likely accelerate again as soon as the force stopped anyway.

There are two other commands for force that I know of: ObjectTemplate.force and ObjectTemplate.rotationalForce x/x/x. I'm not sure what the difference is between ObjectTemplate.constantForce and ObjectTemplate.force.

EDIT: The force on the missile will need to be ALOT higher. Probably in the hundreds. I'm working on it now.

EDIT 2: A constant force of 330 works best with my current code. With 340, the missile starts to reverse if the time out time reaches 17 seconds.
Last edited by M42 Zwilling on 2012-09-03 23:48, edited 2 times in total.
Post Reply

Return to “PR:BF2 Community Modding”