| Blockland Forums > Modification Help |
| A Vehicle With a Turret the Wheels Don't Work |
| (1/1) |
| Uxie:
Yeah. I made a vehicle where it had wheels (obviously) and a turret. It has a problem where the wheels don't show. There must be something I can't seem to notice. For a long while I had this problem. So I just posted it here. The turret works, just not the wheels. --- Code: ---datablock TSShapeConstructor(MCTVMGDts) { baseShape = "./MCTVMG.dts"; sequence0 = "./M_root.dsq root"; sequence1 = "./M_root.dsq run"; sequence2 = "./M_root.dsq walk"; sequence3 = "./M_root.dsq back"; sequence4 = "./M_root.dsq side"; sequence5 = "./M_root.dsq crouch"; sequence6 = "./M_root.dsq crouchRun"; sequence7 = "./M_root.dsq crouchBack"; sequence8 = "./M_root.dsq crouchSide"; sequence9 = "./M_look.dsq look"; sequence10 = "./M_root.dsq headside"; sequence11 = "./M_root.dsq headUp"; sequence12 = "./M_root.dsq jump"; sequence13 = "./M_root.dsq standjump"; sequence14 = "./M_root.dsq fall"; sequence15 = "./M_root.dsq land"; sequence16 = "./M_root.dsq armAttack"; sequence17 = "./M_root.dsq armReadyLeft"; sequence18 = "./M_root.dsq armReadyRight"; sequence19 = "./M_root.dsq armReadyBoth"; sequence20 = "./M_root.dsq spearready"; sequence21 = "./M_root.dsq spearThrow"; sequence22 = "./M_root.dsq talk"; sequence23 = "./M_root.dsq death1"; sequence24 = "./M_root.dsq shiftUp"; sequence25 = "./M_root.dsq shiftDown"; sequence26 = "./M_root.dsq shiftAway"; sequence27 = "./M_root.dsq shiftTo"; sequence28 = "./M_root.dsq shiftLeft"; sequence29 = "./M_root.dsq shiftRight"; sequence30 = "./M_root.dsq rotCW"; sequence31 = "./M_root.dsq rotCCW"; sequence32 = "./M_root.dsq undo"; sequence33 = "./M_root.dsq plant"; sequence34 = "./M_root.dsq sit"; sequence35 = "./M_root.dsq wrench"; }; datablock PlayerData(MCTVMGPlayer) { renderFirstPerson = true; emap = false; ShootOnClick=1; ShootOnClick_Hold=1; ShootOnClick_ShootDelay=120; ShootOnClick_ReShootDelay=120;//exec("add-ons/vehicle_MCTVMG/vehicle_MCTVMG.cs"); ShootOnClick_ProjectileCount=1; ShootOnClick_RequiredSlot=0; ShootOnClick_Sound=gunshot1Sound; ShootOnClick_Projectile[0]=gunProjectile; ShootOnClick_Position[0]="3 0 2"; ShootOnClick_Velocity[0]="200 0 0"; ShootOnClick_Scale[0]="1 1 1"; className = Armor; shapeFile = "./MCTVMG.dts"; cameraMaxDist = 8; cameraTilt = 0.261; cameraVerticalOffset = 2.3; computeCRC = false; canObserve = true; cmdCategory = "Clients"; cameraDefaultFov = 90.0; cameraMinFov = 5.0; cameraMaxFov = 120.0; //debrisShapeName = "~/data/player/debris_player.dts"; //debris = horseDebris; aiAvoidThis = true; minLookAngle = -1.5708; maxLookAngle = 0.2; maxFreelookAngle = 3.0; mass = 200; drag = 0.1; maxdrag = 0.52; density = 0.7; maxDamage = 250; maxEnergy = 10; repairRate = 0.33; energyPerDamagePoint = 75.0; rechargeRate = 0.4; runForce = 0 * 0; runEnergyDrain = 0; minRunEnergy = 0; maxForwardSpeed = 0; maxBackwardSpeed = 0; maxSideSpeed = 0; maxForwardCrouchSpeed = 0; maxBackwardCrouchSpeed = 0; maxSideCrouchSpeed = 0; maxForwardProneSpeed = 0; maxBackwardProneSpeed = 0; maxSideProneSpeed = 0; maxForwardWalkSpeed = 0; maxBackwardWalkSpeed = 0; maxSideWalkSpeed = 0; maxUnderwaterForwardSpeed = 0; maxUnderwaterBackwardSpeed = 0; maxUnderwaterSideSpeed = 0; jumpForce = 0 * 0; //8.3 * 90; jumpEnergyDrain = 0; minJumpEnergy = 0; jumpDelay = 0; minJetEnergy = 0; jetEnergyDrain = 0; canJet = 0; recoverDelay = 0; recoverRunForceScale = 1.2; minImpactSpeed = 250; speedDamageScale = 3.8; boundingBox = vectorScale("2.5 2.5 1.7", 4); crouchBoundingBox = vectorScale("2.5 2.5 1.7", 4); proneBoundingBox = vectorScale("2.5 2.5 1.7", 4); pickupRadius = 0.75; // Damage location details boxNormalHeadPercentage = 0.83; boxNormalTorsoPercentage = 0.49; boxHeadLeftPercentage = 0; boxHeadRightPercentage = 1; boxHeadBackPercentage = 0; boxHeadFrontPercentage = 1; // Foot Prints //decalData = HorseFootprint; //decalOffset = 0.25; jetEmitter = playerJetEmitter; jetGroundEmitter = playerJetGroundEmitter; jetGroundDistance = 4; //footPuffEmitter = LightPuffEmitter; footPuffNumParts = 10; footPuffRadius = 0.25; //dustEmitter = LiftoffDustEmitter; splash = PlayerSplash; splashVelocity = 4.0; splashAngle = 67.0; splashFreqMod = 300.0; splashVelEpsilon = 0.60; bubbleEmitTime = 0.1; splashEmitter[0] = PlayerFoamDropletsEmitter; splashEmitter[1] = PlayerFoamEmitter; splashEmitter[2] = PlayerBubbleEmitter; mediumSplashSoundVelocity = 10.0; hardSplashSoundVelocity = 20.0; exitSplashSoundVelocity = 5.0; // Controls over slope of runnable/jumpable surfaces runSurfaceAngle = 85; jumpSurfaceAngle = 86; minJumpSpeed = 20; maxJumpSpeed = 30; horizMaxSpeed = 68; horizResistSpeed = 33; horizResistFactor = 0.35; upMaxSpeed = 80; upResistSpeed = 25; upResistFactor = 0.3; footstepSplashHeight = 0.35; //NOTE: some sounds commented out until wav's are available JumpSound = HorseJumpSound; // Footstep Sounds //FootSoftSound = HorseFootFallSound; //FootHardSound = HorseFootFallSound; //FootMetalSound = HorseFootFallSound; //FootSnowSound = HorseFootFallSound; //FootShallowSound = HorseFootFallSound; //FootWadingSound = HorseFootFallSound; //FootUnderwaterSound = HorseFootFallSound; //FootBubblesSound = FootLightBubblesSound; //movingBubblesSound = ArmorMoveBubblesSound; //waterBreathSound = WaterBreathMaleSound; //impactSoftSound = ImpactLightSoftSound; //impactHardSound = ImpactLightHardSound; //impactMetalSound = ImpactLightMetalSound; //impactSnowSound = ImpactLightSnowSound; //impactWaterEasy = ImpactLightWaterEasySound; //impactWaterMedium = ImpactLightWaterMediumSound; //impactWaterHard = ImpactLightWaterHardSound; groundImpactMinSpeed = 10.0; groundImpactShakeFreq = "4.0 4.0 4.0"; groundImpactShakeAmp = "1.0 1.0 1.0"; groundImpactShakeDuration = 0.8; groundImpactShakeFalloff = 10.0; //exitingWater = ExitingWaterLightSound; observeParameters = "0.5 4.5 4.5"; // Inventory Items maxItems = 10; //total number of bricks you can carry maxWeapons = 5; //this will be controlled by mini-game code maxTools = 5; //uiName = "MCTV MG"; rideable = true; lookUpLimit = 0.6; lookDownLimit = 0.7; canRide = false; showEnergyBar = false; paintable = true; brickImage = horseBrickImage; //the imageData to use for brick deployment numMountPoints = 1; mountThread[0] = "armreadyboth"; //protection for passengers protectPassengersBurn = true; //protect passengers from the burning effect of explosions? protectPassengersRadius = true; //protect passengers from radius damage (explosions) ? protectPassengersDirect = false; //protect passengers from direct damage (bullets) ? }; datablock ParticleData(MCTVSmokeParticle) { dragCoefficient = 3; gravityCoefficient = -1; inheritedVelFactor = 0.6; constantAcceleration = 0.0; lifetimeMS = 850; lifetimeVarianceMS = 55; textureName = "base/data/particles/cloud"; spinSpeed = 10.0; spinRandomMin = -500.0; spinRandomMax = 500.0; colors[0] = "0.5 0.5 0.5 0.2"; colors[1] = "0.5 0.5 0.5 0.0"; sizes[0] = 0.6; sizes[1] = 0.8; useInvAlpha = true; }; datablock ParticleEmitterData(MCTVSmokeEmitter) { ejectionPeriodMS = 10; periodVarianceMS = 4; ejectionVelocity = 3; velocityVariance = 2; ejectionOffset = 0; thetaMin = 0; thetaMax = 50; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "MCTVSmokeParticle"; }; datablock ShapeBaseImageData(MCTVSmokeImage) { shapeFile = "base/data/shapes/empty.dts"; emap = false; mountPoint = 1; stateName[0] = "Ready"; stateTransitionOnTimeout[0] = "FireA"; stateTimeoutValue[0] = 0.01; stateName[1] = "FireA"; stateTransitionOnTimeout[1] = "FireB"; stateWaitForTimeout[1] = True; stateTimeoutValue[1] = 0.05; stateEmitter[1] = vehicleFinalExplosionEmitter3; stateEmitterTime[1] = 0.05; stateName[2] = "FireB"; stateTransitionOnTimeout[2] = "FireC"; stateWaitForTimeout[2] = True; stateTimeoutValue[2] = 0.05; stateEmitter[2] = vehicleExplosionEmitter; stateEmitterTime[2] = 0.05; stateName[3] = "FireC"; stateTransitionOnTimeout[3] = "Done"; stateWaitForTimeout[3] = True; stateTimeoutValue[3] = 0.850; stateEmitter[3] = MCTVSmokeEmitter; stateEmitterTime[3] = 0.850; stateName[4] = "Done"; stateScript[4] = "onDone"; }; function MCTVSmokeImage::onDone(%this,%obj,%slot) { %obj.unMountImage(%slot); } datablock WheeledVehicleTire(MCTVTire) { // Tires act as springs and generate lateral and longitudinal // forces to move the vehicle. These distortion/spring forces // are what convert wheel angular velocity into forces that // act on the rigid body. shapeFile = "./jeeptire.dts"; mass = 10; radius = 1; staticFriction = 5; kineticFriction = 5; restitution = 0.5; // Spring that generates lateral tire forces lateralForce = 18000; lateralDamping = 4000; lateralRelaxation = 0.01; // Spring that generates longitudinal tire forces longitudinalForce = 14000; longitudinalDamping = 2000; longitudinalRelaxation = 0.01; }; datablock WheeledVehicleSpring(MCTVSpring) { // Wheel suspension properties length = 0.2; // Suspension travel force = 6000; //3000; // Spring force damping = 800; //600; // Spring damping antiSwayForce = 6; //3; // Lateral anti-sway force }; // Sounds // //////////// datablock AudioProfile(fastImpactSound) { filename = "./fastimpact.WAV"; description = AudioDefault3d; preload = true; }; datablock AudioProfile(slowImpactSound) { filename = "./slowimpact.wav"; description = AudioDefault3d; preload = true; }; // Vehicle // ///////////// datablock WheeledVehicleData(MCTVVehicle) { category = "Vehicles"; displayName = " "; shapeFile = "./MCTV.dts"; //"~/data/shapes/skivehicle.dts"; // emap = true; minMountDist = 3; numMountPoints = 16; mountThread[0] = "sit"; mountThread[1] = "sit"; mountThread[2] = "sit"; mountThread[3] = "root"; mountThread[4] = "root"; mountThread[5] = "root"; mountThread[6] = "root"; mountThread[7] = "sit"; mountThread[8] = "sit"; mountThread[9] = "sit"; mountThread[10] = "root"; mountThread[11] = "root"; mountThread[12] = "root"; mountThread[13] = "root"; mountThread[14] = "root"; mountThread[15] = "armreadyboth"; maxDamage = 600.00; destroyedLevel = 600.00; speedDamageScale = 1.04; collDamageThresholdVel = 5.0; collDamageMultiplier = 0.01; massCenter = "0 0 0"; //massBox = "2 5 1"; maxSteeringAngle = 0.8; // Maximum steering angle, should match animation integration = 4; // Force integration time: TickSec/Rate tireEmitter = VehicleTireEmitter; // All the tires use the same dust emitter // 3rd person camera settings cameraRoll = false; // Roll the camera with the vehicle cameraMaxDist = 13; // Far distance from vehicle cameraOffset = 7.5; // Vertical offset from camera mount point cameraLag = 0.4; // Velocity lag of camera cameraDecay = 0.75; // Decay per sec. rate of velocity lag cameraTilt = 0.4; collisionTol = 0.1; // Collision distance tolerance contactTol = 0.1; useEyePoint = false; defaultTire = MCTVTire; defaultSpring = MCTVSpring; //flatTire = jeepFlatTire; //flatSpring = jeepFlatSpring; numWheels = 6; // Rigid Body mass = 300; density = 5.0; drag = 1.6; bodyFriction = 0.6; bodyRestitution = 0.6; minImpactSpeed = 10; // Impacts over this invoke the script callback softImpactSpeed = 10; // Play SoftImpact Sound hardImpactSpeed = 15; // Play HardImpact Sound groundImpactMinSpeed = 10.0; // Engine engineTorque = 9500; //4000; // Engine power engineBrake = 1500; // Braking when throttle is 0 brakeTorque = 15000; // When brakes are applied maxWheelSpeed = 30; // Engine scale by current speed / max speed rollForce = 600; yawForce = 400; pitchForce = 800; rotationalDrag = 0.2; // Advanced Steering steeringAutoReturn = true; steeringAutoReturnRate = 0.9; steeringAutoReturnMaxSpeed = 10; steeringUseStrafeSteering = true; steeringStrafeSteeringRate = 0.1; // Energy maxEnergy = 100; jetForce = 3000; minJetEnergy = 30; jetEnergyDrain = 2; splash = vehicleSplash; splashVelocity = 4.0; splashAngle = 67.0; splashFreqMod = 300.0; splashVelEpsilon = 0.60; bubbleEmitTime = 1.4; splashEmitter[0] = vehicleFoamDropletsEmitter; splashEmitter[1] = vehicleFoamEmitter; splashEmitter[2] = vehicleBubbleEmitter; mediumSplashSoundVelocity = 10.0; hardSplashSoundVelocity = 20.0; exitSplashSoundVelocity = 5.0; //mediumSplashSound = ""; //hardSplashSound = ""; //exitSplashSound = ""; // Sounds // jetSound = ScoutThrustSound; //engineSound = idleSound; //squealSound = skidSound; softImpactSound = slowImpactSound; hardImpactSound = fastImpactSound; //wheelImpactSound = slowImpactSound; // explosion = VehicleExplosion; justcollided = 0; uiName = "MCTV "; rideable = true; lookUpLimit = 0.65; lookDownLimit = 0.45; paintable = true; damageEmitter[0] = VehicleBurnEmitter; damageEmitterOffset[0] = "0.0 0.0 0.0 "; damageLevelTolerance[0] = 0.99; damageEmitter[1] = VehicleBurnEmitter; damageEmitterOffset[1] = "0.0 0.0 0.0 "; damageLevelTolerance[1] = 1.0; numDmgEmitterAreas = 1; initialExplosionProjectile = MCTVExplosionProjectile; initialExplosionOffset = 0; //offset only uses a z value for now burnTime = 4000; finalExplosionProjectile = MCTVFinalExplosionProjectile; finalExplosionOffset = 0.5; //offset only uses a z value for now minRunOverSpeed = 4; //how fast you need to be going to run someone over (do damage) runOverDamageScale = 8; //when you run over someone, speed * runoverdamagescale = damage amt runOverPushScale = 1.2; //how hard a person you're running over gets pushed //protection for passengers protectPassengersBurn = false; //protect passengers from the burning effect of explosions? protectPassengersRadius = false; //protect passengers from radius damage (explosions) ? protectPassengersDirect = false; //protect passengers from direct damage (bullets) ? }; function MCTVVehicle::onAdd(%this,%obj) { // 4 wheel steering %obj.setWheelSteering(0,1); %obj.setWheelSteering(1,1); %obj.setWheelSteering(2,0); %obj.setWheelSteering(3,0); %obj.setWheelSteering(4,0); %obj.setWheelSteering(5,0); // 4 wheel drive %obj.setWheelPowered(0,true); %obj.setWheelPowered(1,true); %obj.setWheelPowered(2,true); %obj.setWheelPowered(3,true); %obj.setWheelPowered(4,true); %obj.setWheelPowered(5,true); // turret %t = new AIPlayer() { dataBlock = MCTVMGPlayer; }; MissionCleanup.add(%t); %obj.mountObject(%t, 15); %obj.turret = %t; %obj.creationTime = getSimTime(); %t.schedule(15,"rigTurret"); } function Player::rigTurret(%obj) { if(%obj.dataBlock !$= MCTVMGPlayer) return; if(!isObject(%obj)) return; %parent = %obj.getObjectMount(); if(!isObject(%parent)) return; %obj.spawnBrick = %parent.spawnBrick; %obj.brickGroup = %parent.brickGroup; } function MCTVVehicle::onRemove(%this,%obj) { if(isObject(%obj.turret)) %obj.turret.delete(); } function MCTVMGPlayer::onDriverLeave(%this,%obj) { %obj.setTransform("0 0 0 0 0 0 0"); } function MCTVMGPlayer::onDriverLeave(%this,%obj) { } --- End code --- I think it's somewhere in this code below. Just from my knoledge of scripting vehicles I think it would be in here. --- Code: ---function MCTVVehicle::onAdd(%this,%obj) { // 4 wheel steering %obj.setWheelSteering(0,1); %obj.setWheelSteering(1,1); %obj.setWheelSteering(2,0); %obj.setWheelSteering(3,0); %obj.setWheelSteering(4,0); %obj.setWheelSteering(5,0); // 4 wheel drive %obj.setWheelPowered(0,true); %obj.setWheelPowered(1,true); %obj.setWheelPowered(2,true); %obj.setWheelPowered(3,true); %obj.setWheelPowered(4,true); %obj.setWheelPowered(5,true); // turret %t = new AIPlayer() { dataBlock = MCTVMGPlayer; }; MissionCleanup.add(%t); %obj.mountObject(%t, 15); %obj.turret = %t; %obj.creationTime = getSimTime(); %t.schedule(15,"rigTurret"); } --- End code --- I also know- oops I forgot. - oh wait I remember. I also know that it shows no error at all in the vehicle. When I spawn it, and when it's executing. |
| Barnabas:
I'm no coder, but I think you are looking for the problem at the right place. I think this bit should be inserted to fix it: --- Code: --- %obj.setWheelTire(0,<yourtirename>); %obj.setWheelTire(1,<yourtirename>); %obj.setWheelTire(2, <yourtirename>); %obj.setWheelTire(3, <yourtirename>); --- End code --- and probably this too: --- Code: --- %obj.setWheelSpring(0, <yourspring>); %obj.setWheelSpring(1, <yourspring>); %obj.setWheelSpring(2, <yourspring>); %obj.setWheelSpring(3, <yourspring>); --- End code --- |
| Uxie:
Hey look I think that is the problem. I guess that code requiers to define the wheels or they don't exist. Edit: Barna I love you. No Homo. |
| Navigation |
| Message Index |