rhysm_08 Posted November 10, 2010 Report Share Posted November 10, 2010 I've been pulling my hair at a recent problem i have created, rotating projectiles. I have been wanting to do a nice "Thowing Knife". Added a force object, but found that constant force works, but there is not "rotational-constant force". I managed to make the projectile, slowed it down so i can tinker it (quite eerie, heaps of knifes moving very slowly at a constant speed). But could only get it to curve like "bullet-drop". Anybody no of a solution to making a nice rotating knife effect? Quote Link to comment Share on other sites More sharing options...
Chael Posted November 16, 2010 Report Share Posted November 16, 2010 Err... unless I'm missing something, couldn't you just use a rotational bundle? I did this before with CD projectiles: just make a projectile with no geometry, addTemplate a rotBundle, then addTemplate a knife mesh (no cols) to that. Then if you want your knife to stick to walls and stuff (no moving objects) you could create a material effect that creates a static particle of a knife on impact. Hope this is what you meant. Quote Link to comment Share on other sites More sharing options...
rhysm_08 Posted November 21, 2010 Author Report Share Posted November 21, 2010 (edited) Hmm i have tried that, but (at least in bfeditor), it doesn't spin (using continous rotation speed), please explain about the materials, don't know much about that, thanks. Basically this is how it should work: "Fire" the knife. Knife projectile comes out spinning vertically, hits player, kills them. If it hits a wall then it sticks. Doesn't work ingame either, just tested - unrotating... Knife part of it ObjectTemplate.create GenericProjectile kni_knife_Projectile ObjectTemplate.modifiedByUser "Rhys" ObjectTemplate.createNotInGrid 1 ObjectTemplate.createdInEditor 1 rem ---BeginComp:DefaultCollisionComp --- ObjectTemplate.createComponent DefaultCollisionComp ObjectTemplate.collision.hasCollisionEffect 1 ObjectTemplate.collision.bouncing 1 rem ---EndComp --- rem ---BeginComp:DefaultDetonationComp --- ObjectTemplate.createComponent DefaultDetonationComp ObjectTemplate.detonation.detectionRadius 1.5 ObjectTemplate.detonation.maxDepthForExplosion 2 rem ---EndComp --- rem ---BeginComp:DefaultProjSoundComp --- ObjectTemplate.createComponent DefaultProjSoundComp rem ---EndComp --- rem ---BeginComp:DefaultPenetrateComp --- ObjectTemplate.createComponent DefaultPenetrateComp ObjectTemplate.penetrate.allowSolidPenetration 0 rem ---EndComp --- ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 ObjectTemplate.hasCollisionPhysics 1 ObjectTemplate.physicsType Point ObjectTemplate.collisionGroups 8 ObjectTemplate.material 48 rem ------------------------------------- ObjectTemplate.addTemplate S_kni_knife_Projectile_Looping ObjectTemplate.addTemplate kni_knife_Spin rem ------------------------------------- ObjectTemplate.timeToLive CRD_NONE/90/0/0 ObjectTemplate.material 48 ObjectTemplate.hasOnTimeEffect 1 ObjectTemplate.damage 30 Rotate part ObjectTemplate.create RotationalBundle kni_knife_Spin ObjectTemplate.creator Unknown ObjectTemplate.modifiedByUser Unknown ObjectTemplate.setNetworkableInfo BasicInfo ObjectTemplate.geometry KNI_Knife ObjectTemplate.physicsType Mesh ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 ObjectTemplate.hasCollisionPhysics 0 ObjectTemplate.gravityModifier 0.5 rem ------------------------------------- ObjectTemplate.addTemplate S_kni_knife_Spin_RotationRpm rem ------------------------------------- ObjectTemplate.setMinRotation 0/0/0 ObjectTemplate.setMaxRotation 0/0/0 ObjectTemplate.setMaxSpeed 0/900/0 ObjectTemplate.setContinousRotationSpeed 0/900/0 ObjectTemplate.activeSafe Sound S_kni_knife_Spin_RotationRpm ObjectTemplate.modifiedByUser Unknown Edited November 21, 2010 by rhysm_08 Quote Link to comment Share on other sites More sharing options...
Chael Posted November 21, 2010 Report Share Posted November 21, 2010 (edited) Let's see... Mine looks like this: ObjectTemplate.create RotationalBundle cameraBullet_AOL_Canada_rotation ObjectTemplate.activeSafe RotationalBundle cameraBullet_AOL_Canada_rotation ObjectTemplate.modifiedByUser Chael ObjectTemplate.setNetworkableInfo BasicInfo ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 ObjectTemplate.hasCollisionPhysics 1 rem ------------------------------------- ObjectTemplate.addTemplate AOL_CD_07_ver6_goldLions rem ------------------------------------- ObjectTemplate.setMaxSpeed 1/0/0 ObjectTemplate.setContinousRotationSpeed 200/0/0 Try addTemplating a dummy knife object to your rotBundle (You can see I addTemplated 'AOL_CD_07_ver6_goldLions'). If all else fails, just copy the one I posted; It works. Oh, about the material thing: what I mean is that you want to create an effect that spawns a knife particle on impact with things like walls, ground, etc. You can make it static so it'll stay wherever the knife hits. For impacts with vehicles/moving objects you could use a knife particle that has physics, so when you throw one at a car it will bounce off instead of floating in midair after the car moves. You have to set up the material effect in MaterialManagerSettings.con. Just set up some materials like this: MaterialManager.createCell <knife material #> <wall material #> MaterialManager.setEffectTemplate 0 <static knife effect> Edited November 21, 2010 by Chael Quote Link to comment Share on other sites More sharing options...
rhysm_08 Posted November 21, 2010 Author Report Share Posted November 21, 2010 Ah sounds cool, btw what is "AOL_CD_07_ver6_goldLions?" is it a projectile? Quote Link to comment Share on other sites More sharing options...
Chael Posted November 21, 2010 Report Share Posted November 21, 2010 Isn't it obvious? It's an AOL 6.0 Gold CDROM with lions on it It's just a bundledMesh. Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted November 22, 2010 Report Share Posted November 22, 2010 And that worked on a projectile? Quote Link to comment Share on other sites More sharing options...
Chael Posted November 22, 2010 Report Share Posted November 22, 2010 Sure, why wouldn't it? Quote Link to comment Share on other sites More sharing options...
rhysm_08 Posted November 23, 2010 Author Report Share Posted November 23, 2010 I'm finding it hard to get it working at all, please post your code for that weapon. I'm guessing the soldier throws the cd on the X axis Quote Link to comment Share on other sites More sharing options...
Chael Posted November 23, 2010 Report Share Posted November 23, 2010 (edited) Okay, here's the code for the projectile: .con ObjectTemplate.create GenericProjectile cameraBullet_AOL_Canada ObjectTemplate.saveInSeparateFile 1 ObjectTemplate.creator Chael rem ObjectTemplate.collisionMesh AOL_CD_01_Canada ObjectTemplate.mapMaterial 0 metal 0 ObjectTemplate.hasCollisionPhysics 1 ObjectTemplate.physicsType 3 rem ObjectTemplate.geometry AOL_CD_01_Canada include cameraBullet_AOL_Canada.tweak .tweak rem *** Generated with Bf2Editor.exe [created: 2006/5/15 11:52] GeometryTemplate.compressVertexData 1 GeometryTemplate.maxTextureRepeat 16 ObjectTemplate.activeSafe GenericProjectile cameraBullet_AOL_Canada ObjectTemplate.creator Chael ObjectTemplate.modifiedByUser "Chael" ObjectTemplate.setNetworkableInfo BasicInfo ObjectTemplate.saveInSeparateFile 1 ObjectTemplate.createNotInGrid 1 rem ---BeginComp:DefaultCollisionComp --- ObjectTemplate.createComponent DefaultCollisionComp ObjectTemplate.collision.hasCollisionEffect 1 rem ObjectTemplate.collision.bouncing 1 rem ---EndComp --- rem ---BeginComp:DefaultDetonationComp --- ObjectTemplate.createComponent DefaultDetonationComp ObjectTemplate.detonation.explosionMaterial 0 ObjectTemplate.detonation.explosionRadius 0 ObjectTemplate.detonation.explosionForce 0 ObjectTemplate.detonation.explosionDamage 0 ObjectTemplate.detonation.detonateDistanceToTarget 1 rem ObjectTemplate.detonation.endEffectTemplate e_exp_Xlarge ObjectTemplate.detonation.useMMOnEndEffect 1 rem ---EndComp --- rem ---BeginComp:DefaultProjSoundComp --- ObjectTemplate.createComponent DefaultProjSoundComp rem ---EndComp --- rem ---BeginComp:DefaultPenetrateComp --- ObjectTemplate.createComponent DefaultPenetrateComp ObjectTemplate.penetrate.allowSolidPenetration 1 ObjectTemplate.penetrate.allowLiquidPenetration 1 rem ---EndComp --- rem ObjectTemplate.geometry AOL_CD_01_Canada rem ObjectTemplate.setCollisionMesh AOL_CD_01_Canada ObjectTemplate.mapMaterial 0 metal 31 ObjectTemplate.drag 0 ObjectTemplate.mass 20 ObjectTemplate.gravityModifier 0.05 ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 ObjectTemplate.hasCollisionPhysics 1 ObjectTemplate.physicsType Point ObjectTemplate.collisionGroups 8 ObjectTemplate.material 39 rem ------------------------------------- ObjectTemplate.addTemplate S_cameraBullet_AOL_Canada_Looping ObjectTemplate.addTemplate cameraBullet_AOL_Canada_rotation ObjectTemplate.addTemplate cameraBullet_AOL_Canada_Camera ObjectTemplate.setPosition 0/0.05/-0.2 rem ------------------------------------- ObjectTemplate.timeToLive CRD_NONE/33/0/0 ObjectTemplate.material 39 ObjectTemplate.hasOnTimeEffect 1 ObjectTemplate.minDamage 190 ObjectTemplate.damage 190 rem ObjectTemplate.acceleration 115 rem ObjectTemplate.maxSpeed 95 ObjectTemplate.useProjectileCamera 1 ObjectTemplate.activeSafe Sound S_cameraBullet_AOL_Canada_Looping ObjectTemplate.modifiedByUser "Chael" ObjectTemplate.create Camera cameraBullet_AOL_Canada_Camera ObjectTemplate.modifiedByUser "Chael" ObjectTemplate.createdInEditor 1 ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 0 rem ------------------------------------- ObjectTemplate.addTemplate S_cameraBullet_AOL_Canada_Camera_RotationRpm rem ------------------------------------- ObjectTemplate.setMinRotation 0/0/0 ObjectTemplate.setMaxRotation 0/0/0 ObjectTemplate.setPivotPosition 0/0/0 ObjectTemplate.setMaxSpeed 0/0/0 ObjectTemplate.setAcceleration 0/0/0 ObjectTemplate.CameraId 5 ObjectTemplate.CVMInside 1 ObjectTemplate.CVMFlyBy 1 ObjectTemplate.CVMChase 1 ObjectTemplate.CVMFrontChase 1 ObjectTemplate.CVMNose 1 ObjectTemplate.CVMTrace 1 ObjectTemplate.CVMExternTrace 1 ObjectTemplate.followStiffness 3 ObjectTemplate.chaseDistance 5 ObjectTemplate.chaseAngle 20.5 ObjectTemplate.chaseOffset 0/0/0 ObjectTemplate.worldFOV 1.2 ObjectTemplate.insideFOV 1.2 ObjectTemplate.worldFOV 1.2 ObjectTemplate.insideFOV 1.2 ObjectTemplate.allowInsideDynamicLights 1 ObjectTemplate.allowInsideStaticSun 0 ObjectTemplate.insideStaticSunDirection -0.25/-0.5/0.75 ObjectTemplate.insideStaticSunColor 1/1/1 ObjectTemplate.insideStaticSunDamageColor 1/0/0 ObjectTemplate.insideDamageFrequency 3 ObjectTemplate.insideDamageThreshold 0.15 ObjectTemplate.insideStaticSunAmbientColor 0.7/0.7/0.7 ObjectTemplate.activeSafe Sound S_cameraBullet_AOL_Canada_Camera_RotationRpm ObjectTemplate.modifiedByUser "Chael" ObjectTemplate.create RotationalBundle cameraBullet_AOL_Canada_rotation ObjectTemplate.activeSafe RotationalBundle cameraBullet_AOL_Canada_rotation ObjectTemplate.modifiedByUser Chael ObjectTemplate.setNetworkableInfo BasicInfo ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 ObjectTemplate.hasCollisionPhysics 1 rem ------------------------------------- rem "ADD THE OBJECT YOU WANT TO SPIN HERE" ObjectTemplate.addTemplate aol_cd_01_canada rem ObjectTemplate.addTemplate aol_cd_02 rem ObjectTemplate.addTemplate aol_cd_03_ver5_brownBlack rem ObjectTemplate.addTemplate aol_cd_04_ver7_blueYellow rem ObjectTemplate.addTemplate AOL_CD_05_ver6_yellowBlue rem ObjectTemplate.addTemplate AOL_CD_06_ver7_bluePlatinum rem ObjectTemplate.addTemplate AOL_CD_07_ver6_goldLions rem ------------------------------------- ObjectTemplate.setMaxSpeed 1/0/0 ObjectTemplate.setContinousRotationSpeed 200/0/0 I didn't really create a weapon for this, I just added the projectile to the .50cal. If you want to use the above code with a hand weapon, you'll want to remove the projectile camera (pretty useful for when you need to see it spin though). Hope this is what you need. Edited November 23, 2010 by Chael Quote Link to comment Share on other sites More sharing options...
UberWazuSoldier Posted November 24, 2010 Report Share Posted November 24, 2010 Wow, that's a lot more simple than I had thought haha. The reason I was incredulous was that most objects don't work on Projectiles; ForceObjects for example. Quote Link to comment Share on other sites More sharing options...
Apache Thunder Posted November 25, 2010 Report Share Posted November 25, 2010 (edited) If all else fails you can animate the knife by exporting it as a skinnedMesh and adding an animation to it. I have a couple mario kart stuff I'm adding to a mod and have already got an animated unfolding banana to work as a projectile. (the animated geometry must however be a animatedBundle that is a child object of the projectile). You can the completely rem out the geometry line so the projectile it self has no visible mesh and relies on your animated sub object. Collision is of coarse handled by the projectile. Edited November 25, 2010 by Apache Thunder Quote Link to comment Share on other sites More sharing options...
mschoeldgen[Xww2] Posted November 25, 2010 Report Share Posted November 25, 2010 @Chael: I like the AOL bit,hehehe. If everything else fails you could also use a TorpedoEngine (Those start by themselves ) and add the knife geometry as rotor. Only keep in mind to give the parent (dummy) geometry a set of collisionmeshes. I also remember having made a rotating magazine on an LMG started by pressing the fire button. Quote Link to comment Share on other sites More sharing options...
rhysm_08 Posted November 28, 2010 Author Report Share Posted November 28, 2010 Haha i love all these ingenious solutions! Will post results. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.