Search the Community
Showing results for tags 'Pick'.
-
imported object childed to fbx isnt pickable
Slastraf posted a topic in Leadwerks Engine Bug Reports
I have been hanging on this bug for some time, but now I found it. Basically its when you pick a box that is originally imported as a child from an fbx object, it wont be pickable. I have made a short video on this: https://youtu.be/Pn5is60p8rI -
if window:MouseHit(1) then local pickinfo= PickInfo() local p1 = Window:GetCurrent():GetMousePosition() --local box = Model:Box() if (self.camera:Pick(p1.x,p1.y,pickinfo,0.5,true)) then if pickinfo.entity then if pickinfo.entity:GetKeyValue("Button")~="" then --box:SetScale(0.2,0.2,0.2) --box:SetPosition(pickinfo.entity:GetPosition(true),true) System:Print(tostring(pickinfo.entity:GetKeyValue("Button"))) end end end end the above is the camera pick , I cant find anything . The camera pick should Print the Key value of the box in the script below. However, it prints nothing and I dont know why. Script.localKeyValue = -1--string " Key Value Integer" function Script:Start() self.entity:SetKeyValue("Button",self.localKeyValue) end
- 1 reply
-
- GetKeyValue
- Camera
-
(and 1 more)
Tagged with:
-
I have a third person character controller, the character has pickmode(0). I can walk around and have obstacles between the player and the cam , but nothing happens? the self.pivot is a pivot which is at the center of the character (the camera focus). updateworld: if self.entity.world:Pick(self.pivot:GetPosition(),self.camera:GetPosition(),pickinfo,0,true) then local model2 = Model:Box() model2:SetPickMode(0) model2:SetPosition(pickinfo.position) model2:SetColor(0,1,0) System:Print(">> PICKED") --self.camera:SetPosition(pickinfo.position) end
- 3 replies
-
- Third Person
- Pick
-
(and 2 more)
Tagged with:
-
Forgive me if this is a silly question, but my previous experience with collision normals is as follows: collision on X should return Vec3(1,0,0) collision on -X should return Vec3(-1,0,0) collision on Y should return Vec3(0,1,0) collision on -Y should return Vec3(0,-1,0) collision on Z should return Vec3(0,0,1) collision on -Z should return Vec3(0,0,-1) Leadwerks pickinfo.normal returns a fraction depending on where on a face the collision occurs. Is pickinfo.face the "normal" function I'm used to, and maybe pickinfo.normal is describing the hit point? If this is the case, how do you use pickinfo.face, I couldn't find much documentation on it? Thanks!
-
Hi I went through the Object script tutorials and I've gotten that crate model to rotate. I've also tested out the Pick example for the Camera class. Now my question how do I make a Camera object that I placed in the editor to do a "Pick" on the crate model then have that model rotate (and maybe even play a sound)?
-
I'm trying to translate my raycasting experience in Unity and Blender GE to Leadwerks, but I'm having a hard time connecting the dots. My test scene includes one cube on the ground, and another cube next to the first (on X axis) and raised above the ground and above the height of the ground cube so that when the game starts, the raised cube falls next to the ground cube. I have a lua script attached to the ground cube and I'm trying to cast a ray from the ground cubes position to a position farther down the x axis so that the raised cube will intersect when it falls. This is my code in the UpdateWorld function. I get an blank error window. I'm very inexperienced with Leadwerks, so I may be going about it all wrong, but this is what I've gathered from the docs. Thanks for any help you can provide. function Script:UpdateWorld() self.position = self.entity:GetPosition() self.right = Vec3(self.position.x + self.right.x, self.position.y, self.position.z); local pickInfo = PickInfo() local clear = true local world = World:GetCurrent() local context = Context:GetCurrent() local pos = self.camera:Project(Vec3(self.position)) local pRight = self.camera:Project(Vec3(self.right)) context:DrawLine(pos.x, pos.y, pRight.x, pRight.y) if (world:Pick(self.position, self.right, pickinfo, 0.0, true)) then clear= false end end