Jump to content

[solved] Getting bone direction and scale.


shadmar
 Share

Recommended Posts

I'm creating a spaceship that will have emitters based on a bone location emitting in the bone local direction.

My spaceship has bones for every thruster with size location and direction.

 

self.child = self.entity:FindChild("thruster_linear_1")
if self.child then
self.emitter = Emitter:Create(1000)
self.emitter:SetEmissionVolume(Vec3(.01,.01,.01));
self.emitter:SetPosition(self.child:GetPosition())
self.emitter:SetVelocity(Vec3(self.child:GetRotation())) --this didin't work
end

 

Any ideas how I can proceeed to have the emitter emit along the bone vector and scale?

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

I have used Matrix (the functions not the movie laugh.png )

But what as lacking was functions to move relative to attach point and turn relative to it, all ith matrix functions.

Search for my old post on "Matrix or attaching"

Stop toying and make games

Link to comment
Share on other sites

Nice this now works : Emitter will align to bone by the y-axis (exported from UU3D) and scale to bone scale correctly.

 

function Script:Start()
   self.entity:SetRotation(45,45,0); --rotate spaceship
   self.child = self.entity:FindChild("thruster1") --find thruster bone
   if self.child then
       self.emitter = Emitter:Create(1000) --create an emitter for it
       self.emitter:SetEmissionVolume(Vec3(0.1,4,0.1));
   end
end

function Script:UpdateWorld()
   if self.child then
   self.entity:Turn(Time:GetSpeed()*0.02,Time:GetSpeed()*0.05,Time:GetSpeed()*0.03); 

   self.emitter:SetMatrix(self.child:GetMatrix()) --align emitter to bone
   self.emitter:SetScale(self.child:GetScale()) --scale emitter by bone scale
   end
end

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

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...