Jump to content

Slastraf

Members
  • Content Count

    447
  • Joined

  • Last visited

Community Reputation

79 Excellent

About Slastraf

  • Rank
    Advanced Member
  • Birthday 03/05/1998

Profile Information

  • Gender
    Male
  • Interests
    3D modeling (Blender), Level Design, Animating

Recent Profile Visitors

11,208 profile views
  1. It was fixed. Please ignore / remove this thread
  2. Slastraf

    AI Crash

    Maybe make a new fps project and try out the default crawler and so on there ? Because I didn't experience so bad behaviour yet.
  3. Slastraf

    AABB not see entity

    Call needs to be a global function. So far you have Call in the Script as a local function. To make it global paste it in main.lua , maybe somewhere at the top : function Call(entity,extra) --not use function Script:... because it is a global function System:Print("See "..tostring(entity:GetKeyValue("name"))) end
  4. Slastraf

    Help with trip wires.

    function Script:CastRay(other) local sprite = Sprite:Create() sprite:SetViewMode(6) local p0 = self.entity:GetPosition(true) local p1 = other:GetPosition(true) self.allignvector = p0 - p1 sprite:SetPosition((p0+p1)/2) sprite:AlignToVector(self.allignvector:Normalize(),2) -- Find distance between the two points. local total_distance = p0:DistanceToPoint(p1) -- Modify the size of the beam based on the 2 points. -- Argument #1 is beamwidth, default .25 sprite:SetSize(.25, total_distance) end Here the script again , inside a function where other (in the parameter) is an entity. Also used LE Math functions to make it run much faster.
  5. Slastraf

    Math / Sprites question

    I found this which could possibly help, but did not test it yet: Update: I added a post there, with my edition of the script.
  6. Slastraf

    Turbo Mode

    Update : Player does not have turbo mode, but can charge electricity spheres by holding a button, and realeasing it sooner will do less damage. For anyone not using discord, prototype already implemented.
  7. Slastraf

    Math / Sprites question

    What would be the best way to make a raycast between two points visible ? It is needed for a mechanic inside the game (no debug DrawLine) local selfpos = self.entity:GetPosition(true) sprite:SetPosition(selfpos+(other:GetPosition(true)-selfpos)*Vec3(0.5, 0.5, 0.5)) So far I came up with this. In this case other is an entity at the second point. It will place an object in the middle of the two Points. The question is how I rotate the model (plane) that it looks toward the Camera without many lines of code, and be reasonable efficient ? And then how do I scale it so that it will have its edges at each point ?
  8. Slastraf

    SetScale will crash LE without warning

    I have not exactly tested this, but if you put this in a n update function it will crash, so after it gets called often times when the value should be very low, probably 0 but it should not at exactly 0. Perhaps with a number that has too many bits from too many decimal places
  9. if self.face:GetScale().x > 0.001 then local newscale = Math:Lerp(self.face:GetScale().x,0,.1) self.face:SetScale(Vec3(newscale,newscale,newscale)) end If you set the scale of a model to a value with many decimal places, LE will crash without warning. Code snippet above will crash without if case
  10. Slastraf

    AABB will not detect all entities

    Okay so for everyone who has the same problem in the future, I fixed this by just transforming the origin point and then adding vectors to make each min and max, as josh said. -- activate currently selected spell --working code if window:KeyHit(Key.Q) then --local model1 = Model:Box() --local model2 = Model:Box() local p1 = Transform:Point(0,0,2.5, self.camera, nil) local pMin = p1 + Vec3(-2,-2,-2.4) local pMax = p1 + Vec3(2,2,2.5) --model1:SetPosition(spellPointMin) --model2:SetPosition(spellPointMax) local aabb = AABB(pMin, pMax) world:ForEachEntityInAABBDo(aabb,"Callback") end
  11. Slastraf

    AABB will not detect all entities

    Do you mean take only the middle point from the Transform:Point() function and then add / substract to make the vectors ? Or do you mean some function I dont know of yet.
  12. Slastraf

    AABB will not detect all entities

    No I have not, but I don't use cpp because I wouldn't know how to set it up. Although if its really necessary I could. There is no documentation on debugAABB also ?
  13. Slastraf

    AAbb does not work

    I think this counts as bad behaviour on leadwerks engine side, I posted this thread and so far haven't been able to solve it:
  14. If I make an aabb in front of the player's camera like this : if window:KeyHit(Key.Q) then --local model1 = Model:Box() --local model2 = Model:Box() local spellPointMin = Transform:Point(-2,-2,0.1, self.camera, nil) local spellPointMax= Transform:Point(2,2,5, self.camera, nil) --model1:SetPosition(spellPointMin) --model2:SetPosition(spellPointMax) local aabb = AABB(spellPointMin, spellPointMax) world:ForEachEntityInAABBDo(aabb,"Callback") end I believe it will work in the standard fpsplayer script, and it uses various functions like ForEachEntity which should call the global "Callback" function on an entity the callback function looks as follows (and works): function Callback(entity,extra) --this function needs to be global, for the aabb in the player script (Somewhere around ...Key.Q... line) if (entity:GetClass()==Object.ModelClass) then if(entity:GetKeyValue("type") == "movEntity") then entity:SetColor(1,0,0) end end end And to make a moveable Entity detect I set a key value as above to the entity. It works all fine, but only sometimes. When I walk toward an object with the KeyValue and constantly press q, nothing happens. However if I then move, and press q again, it works fine. If the angle is right (it sometimes will never work under certain angles no matter if its obfuscated or not) Here is a video : 2019-02-07 22-21-18.mp4 Thats it. I hope someone can help me solve this problem, and its not a bug.
  15. Slastraf

    How to get each entity in aabb

    I made an aabb infront of the camera to check what could be in front of it, but I cant figure out how to do this in lua. so far I have this: if window:KeyHit(Key.Q) then local spellPointMin = Transform:Point(-2,-2,0,self.camera,nil) local spellPointMax= Transform:Point(2,2,5,self.camera,nil) local aabb = AABB(spellPointMin, spellPointMax) world:ForEachEntityInAABBDo(aabb,"PushSelf") end the vectors for the aabb are fine, but the code snippet does not work as expected. I have a function PushSelf on an object inside the aabb box. I guess you cant use it like this ? Ah I understood that the parameter is a global function, and entity is the collided object.
×