Re: Experimental Dummy Vehicles (2013-01-03: R12)
Abdul Alhazred wrote:
A MOSRotating is pretty much just a sprite that can rotate and be collided with. You can probably find more info on the wiki. The movement of the car comes from rotating the wheels, and that is done with lua.
Pretty cool, so your lua gave control to the MOSRotating Pixels?
Now, forgive my misunderstandings but
if self.Ctrl:IsState(Controller.MOVE_LEFT) and self.throttle < 14 then
self.throttle = self.throttle + 0.2
elseif self.Ctrl:IsState(Controller.MOVE_RIGHT) and self.throttle > -14 then
self.throttle = self.throttle - 0.2
else
self.throttle = self.throttle * 0.98
end
Does that give your MOSRotating attachments movement? Or Does that throttle the actor and use the MOSRotating attachments to move?
if not MovableMan:ValidMO(self.Wheels[i]) then -- Initialize or verify wheels
self.Wheels[i] = CreateMOSRotating("APCWheel", "EDV.rte")
self.Wheels[i].Pos = self.WhOfst[i]
self.Wheels[i].Team = self.Team
MovableMan:AddParticle(self.Wheels[i])
end
Tmp = self.Wheels[i].Pos - self.WhOfst[i]
self.Wheels[i].AngularVel = self.throttle
if Tmp.Magnitude > 20 then
self.Wheels[i].Pos = self.WhOfst[i]
self.Wheels[i]:ClearForces()
elseif Tmp.Magnitude > 4 then
force = math.min(Tmp.Magnitude * multi, maxForce)
self.Wheels[i]:AddForce(APCOffset(Vector(0,0), Tmp.AbsRadAngle + 3.141592, Tmp.Magnitude * multi), Vector(0,0))
if self.Vel.Magnitude < 5 and math.abs(self.throttle) > 9.9 and math.abs(self.Wheels[1].AngularVel) > 7 then
self.Wheels[i]:EraseFromTerrain() -- Dislodge wheel if necessary
end
else
self.Wheels[i]:MoveOutOfTerrain(6) -- Sand
end
end
Whats this part do? I'm trying to figure out what part of your lua allows your actor to stick to any surface and defy gravity: