Jump to content

YouGroove

Members
  • Posts

    4,978
  • Joined

  • Last visited

Everything posted by YouGroove

  1. In fact i think specific entities must be stored in App.lua script. It could be an array of weapon names (that could be loaded by other script) etc ... I think we can avoid such function by finding other ways to work. For collision, when it happens you have the entity names , so perhaps really not need for such function i posted ?
  2. Thanks Andy. Again i searched for Vector and Lua in Google some good half hour without good results. Perhaps i should only find a general math forumal and try to write it in Lua using good Lua Math same functions ? I need it, more , caus i have a complete projectile script manageùent that runs well , but it don't follow weapon alignment also No so easy : http://www.physicsfo...ad.php?t=416005 http://www.glbasic.com/forum/index.php?topic=4614.0 I'm not good at Math and vectors. I htink we will need some Lua Math library doing function really needed like : TurnToObject AligntToVector(point3D1, point3D2) etc ... I can't imagine beginner programmers having to go maths or 3D artists
  3. Yes, i don't need collision or bounding box, i just want to be able to get the entity in the world whose name is "player2' bay calling a simple function. It would be good if LE3 could that.
  4. Yes, i don't need collision or bounding box, i just want to be able to get the entity in the world whose name is "player2' bay calling a simple function. It would be good if LE3 could that.
  5. i don't know it works like that automatically, perhaps to avoid people to forget the post I thaught you was giving me the solution of vector alignment.
  6. I have two 3D position points. I would need to align some entity to the vector made of the two 3D points. I mean aligned in the same axe. Does anyone know how to program that ? (in Lua) ?
  7. I have two 3D position points. I would need to align some entity to the vector made of the two 3D points. I mean aligned in the same axe. Does anyone know how to program that ? (in Lua) ?
  8. @MikeClarke : You don't have tested the script i gave to you It's a free camera you can fly go anywhere, just press forward key and use mouse to choose direction. You just need to attach it to a camera and run the game. I think i will respond only to minimum serious people from now
  9. Tested and approved : Have fun (It's made by Chriss and is found on Asset scripts forum part) ---------------------------------------------------------------------- --This script will add mouse and keyboard controls to a camera ---------------------------------------------------------------------- function Script:Start() self.camerarotation=Vec3(0) self.mouseposition=Vec2(0,0) self.movement=Vec3(0,0,0) self.movespeed=20 self.lookspeed=0.1 self.movesmoothing=8 self.looksmoothing=5 self.entity:SetMass(0) self.entity:SetCollisionType(0) self.pivot = Pivot:Create() local shape=Shape:Sphere(0,0,0, 0,0,0, 1,1,1) self.pivot:SetShape(shape) self.pivot:SetMass(1) self.pivot:SetGravityMode(false) self.pivot:SetPosition(self.entity:GetPosition(true),true) self.moveforce=Vec3() self.mouseposition=Vec2() self.mousespeed=Vec2() local window = Window:GetCurrent() local cx=window:GetClientWidth()/2 local cy=window:GetClientHeight()/2 window:SetMousePosition(cx,cy) end function Script:UpdatePhysics() local window = Window:GetCurrent() local cx=window:GetClientWidth()/2 local cy=window:GetClientHeight()/2 local camerarotation = self.entity:GetRotation() local mousepos=window:GetMousePosition() window:SetMousePosition(cx,cy) self.mousespeed.x = Math:Curve(mousepos.x-cx,self.mousespeed.x,self.looksmoothing) self.mousespeed.y = Math:Curve(mousepos.y-cy,self.mousespeed.y,self.looksmoothing) camerarotation.x = camerarotation.x+self.mousespeed.y*self.lookspeed camerarotation.y = camerarotation.y+self.mousespeed.x*self.lookspeed self.entity:SetRotation(camerarotation) local desiredvelocity=Vec3() if window:KeyDown(Key.D) then desiredvelocity.x = desiredvelocity.x+1 end if window:KeyDown(Key.A) then desiredvelocity.x = desiredvelocity.x-1 end if window:KeyDown(Key.W) then desiredvelocity.z = desiredvelocity.z+1 end if window:KeyDown(Key.S) then desiredvelocity.z = desiredvelocity.z-1 end desiredvelocity=desiredvelocity*self.movespeed desiredvelocity = Transform:Vector(desiredvelocity,self.entity,nil) local currentvelocity=self.pivot:GetVelocity() desiredvelocity.x=Math:Curve(desiredvelocity.x,currentvelocity.x,self.movesmoothing) desiredvelocity.y=Math:Curve(desiredvelocity.y,currentvelocity.y,self.movesmoothing) desiredvelocity.z=Math:Curve(desiredvelocity.z,currentvelocity.z,self.movesmoothing) self.moveforce=(desiredvelocity-currentvelocity)*60.0 if self.moveforce:Length()>0 then self.pivot:AddForce(self.moveforce.x,self.moveforce.y,self.moveforce.z) end end function Script:Render() self.entity:SetPosition(self.pivot:GetPosition(true),true) end
  10. Anyone has some code rotation to have weapon aligned to bone always ? (I'll retry to see if i can succed ?)
  11. Yes it is possible finally, a begin of response is here : http://www.leadwerks.com/werkspace/topic/6289-le3-access-to-bones-of-character/
  12. It reamins getRotation for child bone and SetRotation to weapon. i'm playing with true and false argument values for both. But strange it'w weird actually, it comes from code i think. Perhaps i'll make weapons placed at the right bone place in Blender with the model character in edit mode before exporting. I think it wll help.
  13. yes could it be sticks, lines anything, i would want to see the bones and their names with some X ray feature. It could be some option. I exported a character, i need to choose a bone to attach cloth, weapon etc ... if the model editor could show them, we wouldn't have to go back to Blender to find them.
  14. Here is some beginning example I'll add rotation later. function Script:Start() model = Model:Load("Models/other/box.mdl") end attaching code : function Script:UpdatePhysics() ... local child = self.entity:FindChild("Bone.004") local childPos =child:GetPosition(true) model:SetPosition(childPos.x,childPos.y,childPos.z) end
  15. Rick : HOW CAN I THANK YOU ? SO MUCH ? ? Attaching code on LE 3 Working (cube attached to the leg) I don't have put rotation , to keep weapon well rotated,, but i'll do that in some next code. I tested rotation of bones in the same way by code works also. But caus of animationManager it shows and works only at beginning of animation. ***************** The attaching code debut : function Script:Start() model = Model:Load("Models/other/box.mdl") end attaching code : function Script:UpdatePhysics() ... local child = self.entity:FindChild("Bone.004") local childPos =child:GetPosition(true) model:SetPosition(childPos.x,childPos.y,childPos.z) end For finding some entity NPC by name i think perhaps we can do it by using the world entity and use FindChild ?
  16. It would be great to eb able to play animations in loop in clicking a button. I mean playing some extracted animation, with some input parameter that could be speed.
  17. yes i see them. I'll had to figure how to acces them by code, i'll try that Getchild() function.
  18. , yes another, but it seems to be a bug instead ? you should report it.
  19. i don't think it will wrk, we should have some getBone() functions. And i have bone names like : "bone.001" etc ... so it won't work. But i'll rename one and give it a try. How does it workson LE 2 ? Perhaps LE2 never had bones attaching functions ?
  20. Found it, in fact the error was comming from parameters. To call it , just use self (that means this script like Java where you can use the keyword "this") self:placeProjectile()
  21. Is there a way to access bones of a character ? In programming reference, there is nothing ?
  22. Actually you can't attach weapon by code. You have to have a character with weapon on same model, as a whole animated model. If you just need to have weapo or character in front of camera, this can be done. There is a script in the "Assets" of LeadWorks site: "freelook" camera, i htink it's a good start for you. It's for LE 2 or LE 3 ?
  23. i have a script : simpleMov.lua this function function Script:placeProjectile() local targetpos = self.entity:GetPosition(false) model:SetPosition(targetpos.x,targetpos.y,targetpos.z) end And i would want ot call it from updatePhysics method. function Script:UpdatePhysics() ... self.entity:SetInput(0,move,strafe) if window:KeyDown(Key.Space) then simplemov:placeProjectile(entity.goblinai) end end But it don't work ? Someone know how to call the function ? Sadly on AI.lua, Player.lua, there is only callbacks, not direct calls as this one i want to do
  24. In the panel assets, i put character, delete some, i loose time deleting them. WE have to open right click menu , on selected character and choose "delete" the confirm box appears with "yes", "no" i confirm andit's deleted. The Delete key don't work. So could we have "Delete" key to go lot more faster to delete ressources ? Perhaps remove the dialog box, if you delete by pressing "Del" it's because you want to delete the asset. No need to loose time with a dialog box. If you delete by inadvertance pressing "Del" key it would be strange, and you can at least re import your asset
×
×
  • Create New...