Jump to content

Emmiters in vehicle!


Gilmer
 Share

Recommended Posts

Why after update to 2.4 version, dont's emitting particles in vehicle? For sample, in 'vehicle_viperscout.lua', if i put:

object.emitter[n]:Paint(LoadMaterial("abstract::roaddust.mat"))

It dont show the particles, in previous versions showed:

http://i55.tinypic.com/2wci3vs.jpg

 

 

Now, if i change to:

object.emitter[n]:Paint(LoadMaterial("abstract::dust.mat"))

It show, but dont get the terrain color.

http://i53.tinypic.com/34eevzo.jpg

 

The materiais is:

roaddust.mat:

texture0="abstract::smoke.dds"
depthmask=0
blend=alpha
zsort=1

shader="abstract::particles.vert","abstract::particles.frag"

 

 

dust.mat:

texture0="abstract::smoke.dds"
depthmask=0
blend=alpha
zsort=1

shader="abstract::particles.vert","abstract::particles_roaddust.frag"

Link to comment
Share on other sites

I'm not sure where to put this code you have written. But I don't get any emitter on the viperscout either. Even though there is a big section of code in the vehicle_viperscout.lua about emitters.

Intel core 2 quad 6600 | Nvidia Geforce GTX460 1GB | 2GB DDR2 Ram | Windows 7.

 

Google Sketchup | Photoshop | Blender | UU3D | Leadwerks Engine 2.4

Link to comment
Share on other sites

I am not getting any particles at all in 2.4 for this vehicle. Something did change in the particle shader because particles do not receive a random draw angle when being created. Whether this has something to do with these particles, I doubt it.

 

have you tried copying the old script to the new one? perhaps there is a small change. I don't see any other reason why this isn't working. :lol:

Link to comment
Share on other sites

Thanks for the answer Aggror. I did not copy the old script. I deleted and did update to see if occurs with the new script, and the result is the same.

 

The script of viperscout.lua is this, i dont know because not's working..

 

require("scripts/class")
require("scripts/loop")
require("scripts/math/math")

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)	

function object:UpdateMatrix()
	self:UpdateTires()
end

function object:UpdateTires()
	local speed
	for n=0,3 do
		if self.tire[n]~=nil then
			self.tire[n]:SetMatrix( self.vehicle:GetTireMatrix(n) )
			if self.emitter[n]~=nil then
				self.emitter[n]:SetMatrix(self.vehicle:GetTireMatrix(n))
				self.emitter[n]:Pause()
				if self.vehicle:TireIsAirborne(n)==0 then
					speed = math.abs(self.model:GetVelocity(0).z)
					speed = (speed - 4) / 20.0
					speed = Clamp( speed, 0, 1 ) * 0.1
					if speed>0 then
						self.emitter[n]:Resume()
						self.emitter[n]:SetColorf(1,1,1,speed)
					end
				end
			end
		end
	end
end

local pivot
local suspensionlength=0.2
local springconstant=20.0
local springdamper=150.0

object.vehicle=CreateVehicle(object.model)
object.tire={}
object.emitter={}

object.turret=object.model:FindChild("turret")

pivot=object.model:FindChild("tire1")
if pivot~=nil then
	tireradius=pivot.aabb.h/2.0
	object.vehicle:AddTire(TFormPoint(pivot.position,pivot.parent,model),tireradius,suspensionlength,springconstant,springdamper)
	object.tire[0]=LoadMesh("abstract::vehicle_viperscout_tire_left.gmf",model)
	pivot:Hide()
end

pivot=object.model:FindChild("tire2")
if pivot~=nil then
	tireradius=pivot.aabb.h/2.0
	object.vehicle:AddTire(TFormPoint(pivot.position,pivot.parent,model),tireradius,suspensionlength,springconstant,springdamper)
	object.tire[1]=LoadMesh("abstract::vehicle_viperscout_tire_right.gmf",model)
	pivot:Hide()
end

pivot=object.model:FindChild("tire3")
if pivot~=nil then
	tireradius=pivot.aabb.h/2.0
	object.vehicle:AddTire(TFormPoint(pivot.position,pivot.parent,model),tireradius,suspensionlength,springconstant,springdamper)
	object.tire[2]=LoadMesh("abstract::vehicle_viperscout_tire_left.gmf",model)
	pivot:Hide()
end

pivot=object.model:FindChild("tire4")
if pivot~=nil then
	tireradius=pivot.aabb.h/2.0
	object.vehicle:AddTire(TFormPoint(pivot.position,pivot.parent,model),tireradius,suspensionlength,springconstant,springdamper)
	object.tire[3]=LoadMesh("abstract::vehicle_viperscout_tire_right.gmf",model)
	pivot:Hide()
end	

object.emitter={}
object:UpdateTires()

if world_transparency~=nil then
	if world_main~=nil then
		SetWorld(world_transparency)
		for n=0,3 do
			if object.tire[n]~=nil then
				object.emitter[n]=CreateEmitter(50,4000,Vec3(0,1,0),0,object.tire[n])
				object.emitter[n]:SetPosition(Vec3(0,-object.tire[n].aabb.h/2.0,0))
				object.emitter[n]:SetParent(model,1)
				object.emitter[n]:SetRadius(1,8)
				object.emitter[n]:SetWaver(1.0)
				object.emitter[n]:Paint(LoadMaterial("abstract::roaddust.mat"))
				object.emitter[n]:SetRotationSpeed(0.1)
				object.emitter[n]:Pause()
			end
		end
		SetWorld(world_main)
	end
end

object.model.buoyant=0
object.model:SetKey("collisiontype",COLLISION_PROP)
object.model:SetKey("mass",1.0)
object:UpdateTires()
end

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...