Search the Community
Showing results for tags 'math'.
-
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 ?
-
I'm looking for the equivalent of Quat:LookRotation(forward, up) (create a quaternion from a forward direction and up). Maybe transform ? but there are no such thing (not able to specify the up direction).
-
What would be the best way to get a specific type of entity in an area? I am currently working on my AI and I want it to search a weapon, if it has no at the moment. So I want it to check its sourrounding for a weapon. Whats the best way to do it. Or I could need it that my AI can check for enemies in its sourrounding. I thought of getting all entities in the scene (world) check their distance to the AI and if it is smaller then the AIs sense radius, then it checks them for the type (for example if it is a weapon or not) and returns to the AI. So whats the best way to get specific entities in a defined area (for example around a NPC)? Any ideas on how to make it better then the concept I have?
-
Hey there! Not entirely sure if this is just on my side, so feel free to delete this if I'm wrong. I'm using Math:Random for my everyday needs in random numbers but it seems like I'm getting the same numbers every time. z = Math:Random(-10,10) So even after restarting my project a few times, z always gets the same value. The info-page states that LUA uses Math:Rnd instead but that just throws an error. Sorry for the inconvenience if I'm just using it wrong but I can't find any other way so far. Greets
-
FYI, Math:Abs() is not listed in the command reference. It's available, and works as expected, just not documented. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/math/
-
- documentation
- lua
-
(and 1 more)
Tagged with: