Jump to content

Conveyor belt


TEPA6ANT
 Share

Recommended Posts

I'm trying to make a conveyor. But faced a problem.

function Script:Collision(entity, position, normal, speed)
	if self.active then
		entity:SetVelocity(self.speed) --self.speed=Vec3(5,0,0)
	end
end

It seems to work. But when the object goes in the opposite direction, its speed is the same as if it did not go on conveyor.
I tried using AddForce. But it is too fast (values below 0.04 (self.speed=Vec3(0.04,0,0)) do not move the object, and above is very fast).
 

Link to comment
Share on other sites

However, not everything works so well. The speed of objects with different Physical Mode on conveyor are always different (Rigid Body goes faster than the Character Controller). How can they be equated?

And another question. How to load a brush entity shader? (just... 

local mat = self.entity:GetMaterial()
mat:SetShader(self.shader) --attempt to index local 'mat' (a nil value)

) This is necessary to make the texture move.

Link to comment
Share on other sites

maybe the character controller and other object have different mass to them.. Try using physicsSetPosition in a loop . Or divide force by mass or something. 

For the shader thing, please explain better what u need, it probably dont need to be scripted. Check out firepit addon in workshop for animated sprite texture

Link to comment
Share on other sites

Quote

maybe the character controller and other object have different mass to them

No. I changed mass of objects, result is same. I need this to be independent of the mass.
 

Quote

physicsSetPosition

I'm honest. Didn't know.
But I tried, the result is not what you need. Object with a Rigid Body, flew somewhere, and with Character Controller stands still.
 

Quote

For the shader thing, please explain better what u need, it probably dont need to be scripted. Check out firepit addon in workshop for animated sprite texture

I just need the texture on the brush to move at the right speed. As in Half-Life for example. 
In entity script, set speed and direction of the texture for shader.
But, as I understand it, the texture of the brush is not so easy to take. (self.entity:GetMaterial() == nil). 

P.S. My English is bad and i'm partly using Google Translate for writing post. (<- Этот текст я написал без использования переводчика)

 

hl.gif

Link to comment
Share on other sites

3 hours ago, Slastraf said:

you can make animated textures in leadwerks, use the shader from the firepit addon or if you have your own one. But you would need a n*n spritesheet

 

I don't need a sprite. I need to move the texture on brush. Just move, I can using shaders. But, using the script, get material, and then set shader for material, this fails. 
And to solve the second problem, I just need to learn how to get material from brush(Box,Wedge,Sphere etc.). 

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