Jump to content

How to make Triggers invisible?


DudeAwesome
 Share

Recommended Posts

ahh good hint. a pivot with shapes should increase performance (vs. csg box with invisible material) I guess or I´m wrong?

 

sure its not much but when its possible I will try not to waste resources

 

I don't think it's easy to make a Pivot have a shape. Just try this:

 

Draw a door and give it the SlidingDoor.lua

  • Name: theSlidingDoor
  • Mass 30.0
  • Collision Type: Scene

 

Then draw a box in front of that door that will be the collision trigger to open it

  • Name: slidingDoorTrigger
  • CollisionTrigger.lua
  • Mass 0.0
  • Collision Type: Trigger
  • Change it's material to \Materials\Effects\Invisible
  • Note, once you change it to invisible, the only way to see the box is to click on the toolbar: View / Show Physics

 

Then, open the Flowgraph Editor and drag in theSlidingDoor and slidingDoorTrigger.

 

Connect the Collision point of slidingDoorTigger to the Open point of theSlidingDoor.

 

Voila.

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

I am only interested in the shape to trigger a collision

 

Could you explain what difference it would matter? Certain engines have certain ways to doing things and this is really LE's way of doing volume triggers. The CSG has a shape and that's is what you are using. Then via the material you are telling the pipeline to not draw the visual part of the CSG. I don't think this slows anything down, so you'd have to ask yourself what difference does it really matter if this is how you accomplish this in LE.

Link to comment
Share on other sites

It would only matter if the invisible material needs a drawcall. The less drawcalls, the better.

Does the invisible material require a drawcall, or not? I think Josh could shed some light on the matter. smile.png

If it needs a drawcall for the invisible material, then maybe a better solution could be made?

 

ZBrush 4R7 64-bit - 3DCoat 4.5 BETA 12 - Fl Studio 12 64Bit - LE 3.2 Indie version - Truespace 7 - Blender 2.71 - iClone 5.51 Pro - iClone 3DXChange 5.51 pipeline - Kontakt 5 - Bryce 7 - UU3D Pro - Substance Designer/Painter - Shadermap 3 - PaintShop Photo Pro X7 - Hexagon - Audacity - Gimp 2.8 - Vue 2015 - Reaktor 5 - Guitar Rig 5 - Bitmap2Material 3

Link to comment
Share on other sites

Could you explain what difference it would matter?

 

A material need resources to storage and there is a drawcall that "draw" the invisible material. I dont need both things in this case and it cost rendertime and storage in my RAM.

 

the minimal information I need is:

 

a nullpoint to find my trigger

and 6 faces (6*2 =12 triangles)

 

 

so I only have a nullpoint = 3 integers // x y z

 

and 12 triangles (12*3= 36 vertices) = 3*36 = 108 integers (or less because some vertices are the same)

 

(sure when I create objects there are more informations)

 

for a cuboid trigger

 

 

 

I would like to have something that isnt drawn in the world and just have shapes to detect collisions maybe a new entity?

  • Upvote 2

It doesn´t work... why? mhmmm It works... why?

Link to comment
Share on other sites

Unless you are seeing any sort of drop in FPS from this (which I doubt) then I personally wouldn't worry about it. The amount of triggers you'll have compared to all the other stuff will most likely be very small. No need to optimize something that isn't causing you issues IMO. It may not be perfect, but very few things in games are. I can't imagine this would be any sort of high priority to Josh as there is a way to do it today that causes little to no slowdown to a game. I don't want to come off as being an *** or anything, but use what the engine has today to do something, and if it cause you problems then you'd have a better leg to stand on coming back to Josh and asking for a change.

 

This is over optimizing something that I'm guessing isn't causing you any problems right now and may never cause you problems.

  • Upvote 1
Link to comment
Share on other sites

I got it now. triggering just with shapes is possible

 

 

if someone is interested in:

 

just add this script to a pivot object and move it to the position where you want the trigger.

 

Size can be manipulated in the Script Tab

 

Press L to show triggers in debug mode

 

 

 

 

Script.Mapfile = "" --path Map
Script.triggerSize = Vec3(1,1,1) --vec3 TriggerSize
Script.triggerVisible = true --bool ShowTrigger
function Script:Start()
self.enabled=true
if self.triggerVisible then
--Create box
self.box = Model:Box(self.triggerSize.x, self.triggerSize.y, self.triggerSize.z)
self.box:SetPosition(self.entity:GetPosition().x, self.entity:GetPosition().y, self.entity:GetPosition().z)
self.box:SetColor(0,1,0)
end
--Create shape
self.entity:SetCollisionType(Collision.Trigger)
self.shape = Shape:Box(0,0,0, 0,0,0, self.triggerSize.x, self.triggerSize.y, self.triggerSize.z)
self.entity:SetShape(self.shape)
self.shape:Release()
end
function Script:Collision(entity, position, normal, speed)
if self.enabled then
self.component:CallOutputs("Collision")
System:Print("BAZINGA")
if(self.Mapfile) ~= "" then
--do a mapload
end

end
end
function Script:Enable()--in
if self.enabled==false then
self.enabled=true
self:CallOutputs("Enable")
end
end
function Script:Disable()--in
if self.enabled then
self.enabled=false
self:CallOutputs("Disable")
end
end

function Script:UpdateWorld()
if DEBUG then
if App.window:KeyHit(Key.L) then
if self.box == nil then
--Create box
self.box = Model:Box(self.triggerSize.x, self.triggerSize.y, self.triggerSize.z)
self.box:SetPosition(self.entity:GetPosition().x, self.entity:GetPosition().y, self.entity:GetPosition().z)
self.box:SetColor(0,1,0)
self.box:Hide()
end
if self.box:Hidden() then
System:Print("Trigger on")
self.box:Show()
else
System:Print("Trigger off")
self.box:Hide()
end
end
end
end

  • Upvote 1

It doesn´t work... why? mhmmm It works... why?

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