-
Posts
41 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by DanceTweety
-
I try to do that with a hinge in my first script but. I am not so good with the hinge command and dont see alot of examples. Also did not get alot of feedback on that script it is at top of this post. I would like it if you could tell me how to couple 2 boxes one to be motor and one the boat then the newton engine could do its work and it would be simple.
-
If I us pointforce it still will not get the boat to sail in the direction it is pointing and it makes the boat sink I tryed that. And what do you mean with "make proper parenting". I dont have a sail or a motor. I am testing with a box.
-
It is not a sailboat but a motorboat I just want it to sail in the direction it is pointing even after I turn it. But it only does that at small angle after that it goes back wards and I dont know why.
-
I hope is more clear now
-
Hi All, I made changes to the script but it still does not make a normale circle when I steer it to left or right And help is welcome. I test it with a box. What I try to do is get the boot to sail in direction of the Y angle: Script.enabled = true --bool "Enabled" Script.gravity = false --bool "Gravity" Script.movespeed = 5 --Define self.movespeed Script.originPosition = nil --Define self.originPosition Script.currentPosition = nil --Define self.currentPosition Script.oldMass = nil --Define self.oldMass Script.window = Window:GetCurrent() --Define self.window Script.move = Vec3(0,0,0) --Define self.move Script.rotation = "" --Define self.rotation Script.ry = 0 --Define self.ry Script.speed = "" --Define self.speed function Script:Start() self.originPosition = self.entity:GetPosition() --Get position of object self.oldMass = self.entity:GetMass() --Get mass of object if self.entity:GetShadowMode()>0 then self.entity:SetShadowMode(2)--Light.Dynamic end if self.enabled then if self.entity:GetMass() == 0 then --Get mass and check if bigger then 0 Debug:Error("Entity mass must be greater than zero.") end else self.entity:SetMass(0) end self.entity:SetGravityMode(self.gravity) --Set gravity to false self.entity:SetFriction(0,1) --Set Friction self.move = Vec3(0,0,0) --Set self.move to vector end function Script:UpdatePhysics() --Loop to update Physics self.move = Vec3(0,0,0) local movespeed = self.movespeed --Set movespeed to self.movespeed self.rotation = self.entity:GetRotation():ToString() --Set self.rotation and make it a string (else it is userdata and will not work) self.ry = string.sub(self.rotation,11,15) --Set self.ry with y of rotation (if cuts of x and z) self.ry = tonumber(self.ry) --Set self.ry to be a number self.ry = math.ceil(self.ry) --Set self.ry to be a round number if (self.window:KeyDown(Key.Up)) then self.move.x = -1 * movespeed * math.cos(self.ry) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Up)) then self.move.z = -1 * movespeed * math.sin(self.ry) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Down)) then self.move.x = movespeed * math.cos(self.ry) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Down)) then self.move.z = movespeed * math.sin(self.ry) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Right)) then self.move.y= movespeed * Time:GetSpeed() end --Look if right arrow key is pressed and Set value in selfmove.y (y-axis rotation) if (self.window:KeyDown(Key.Left)) then self.move.y= -1 * movespeed * Time:GetSpeed() end --Look if left arrow key is pressed and Set value in selfmove.y (y-axis rotation) self.entity:AddForce(self.move.x,0,0) --AddForce with the self.move.x value on x-axis self.entity:AddForce(0,0,self.move.z) --AddForce with the self.move.z value on z-axis self.entity:AddTorque(0,self.move.y*50,0) --AddTorque with the self.move.y value on y-axis (rotation) Time:Update() --Update Time value end function Script:PostRender() --Function to print on game screen local context=Context:GetCurrent() context:SetBlendMode(Blend.Alpha) --Set blend to alpha so only letters will show context:DrawText("Rotation :".. self.ry .."",5,130) --Set text and position of text --context:DrawText("Speed :".. self.speed .."",5,140) --Set text and position of text end
-
Hi All, I made changes to the script but it still does not make a normale circle when I steer it to left or right And help is welcome. I test it with a box. What I try to do is get the boot to sail in direction of the Y angle: Script.enabled = true --bool "Enabled" Script.gravity = false --bool "Gravity" Script.movespeed = 5 --Define self.movespeed Script.originPosition = nil --Define self.originPosition Script.currentPosition = nil --Define self.currentPosition Script.oldMass = nil --Define self.oldMass Script.window = Window:GetCurrent() --Define self.window Script.move = Vec3(0,0,0) --Define self.move Script.rotation = "" --Define self.rotation Script.ry = 0 --Define self.ry Script.speed = "" --Define self.speed function Script:Start() self.originPosition = self.entity:GetPosition() --Get position of object self.oldMass = self.entity:GetMass() --Get mass of object if self.entity:GetShadowMode()>0 then self.entity:SetShadowMode(2)--Light.Dynamic end if self.enabled then if self.entity:GetMass() == 0 then --Get mass and check if bigger then 0 Debug:Error("Entity mass must be greater than zero.") end else self.entity:SetMass(0) end self.entity:SetGravityMode(self.gravity) --Set gravity to false self.entity:SetFriction(0,1) --Set Friction self.move = Vec3(0,0,0) --Set self.move to vector end function Script:UpdatePhysics() --Loop to update Physics self.move = Vec3(0,0,0) local movespeed = self.movespeed --Set movespeed to self.movespeed self.rotation = self.entity:GetRotation():ToString() --Set self.rotation and make it a string (else it is userdata and will not work) self.ry = string.sub(self.rotation,11,15) --Set self.ry with y of rotation (if cuts of x and z) self.ry = tonumber(self.ry) --Set self.ry to be a number self.ry = math.ceil(self.ry) --Set self.ry to be a round number if (self.window:KeyDown(Key.Up)) then self.move.x = -1 * movespeed * math.cos(self.ry) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Up)) then self.move.z = -1 * movespeed * math.sin(self.ry) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Down)) then self.move.x = movespeed * math.cos(self.ry) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Down)) then self.move.z = movespeed * math.sin(self.ry) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Right)) then self.move.y= movespeed * Time:GetSpeed() end --Look if right arrow key is pressed and Set value in selfmove.y (y-axis rotation) if (self.window:KeyDown(Key.Left)) then self.move.y= -1 * movespeed * Time:GetSpeed() end --Look if left arrow key is pressed and Set value in selfmove.y (y-axis rotation) self.entity:AddForce(self.move.x,0,0) --AddForce with the self.move.x value on x-axis self.entity:AddForce(0,0,self.move.z) --AddForce with the self.move.z value on z-axis self.entity:AddTorque(0,self.move.y*50,0) --AddTorque with the self.move.y value on y-axis (rotation) Time:Update() --Update Time value end function Script:PostRender() --Function to print on game screen local context=Context:GetCurrent() context:SetBlendMode(Blend.Alpha) --Set blend to alpha so only letters will show context:DrawText("Rotation :".. self.ry .."",5,130) --Set text and position of text --context:DrawText("Speed :".. self.speed .."",5,140) --Set text and position of text end
-
Ok now I get just set it on BETA and dont enter a password. I had same problem
-
Leadwerks Game Engine on Steam gets plugin post-effects system
DanceTweety commented on Admin's blog entry in Ultra Software Company Blog
Hope it will be in 3.1 indie soon -
Is not working it still works same as normal add force only it capsizes the boat. It does not change the forward direction. So you turn like you would using y axis torque but you stay moving in the same direction so boat ends up sailing backward.
-
Ok gona try it out thanks
-
How can you apply some force on a local point on the boat instead of the whole boat?
-
Hi all, I trying to make a script to make a boat sail. This script works. But to steer it I want to put the script in engine, and put it at the back of the boat(box2 is test box I us to simulate engine) and use a hinge to steer it with y axis. Problem is the hinge dont seem to work in this script I made: Script.enabled = true --bool "Enabled" Script.gravity = false --bool "Gravity" Script.movespeed = 10 Script.originPosition = nil Script.currentPosition = nil Script.oldMass = nil Script.window = Window:GetCurrent() Script.move = Vec3(0,0,0) Script.Parent = boat function Script:Start() self.originPosition = self.entity:GetPosition() self.oldMass = self.entity:GetMass() if self.entity:GetShadowMode()>0 then self.entity:SetShadowMode(2)--Light.Dynamic end if self.enabled then if self.entity:GetMass() == 0 then Debug:Error("Entity mass must be greater than zero.") end else self.entity:SetMass(0) end self.entity:SetGravityMode(self.gravity) self.entity:SetFriction(0,1) self.move = Vec3(0,0,0) self.parent = Model:Box(self.Parent) self.child = Model:Box(self.entity) self.joint = Joint:Hinge(0,10,0, 0,0,1, self.child, self.parent) self.joint:SetLimits(-45,45) self.joint:EnableLimits() end function Script:UpdatePhysics() self.move = Vec3(0,0,0) local movespeed = self.movespeed if (self.window:KeyDown(Key.Down)) then self.move.x= movespeed * Time:GetSpeed() end if (self.window:KeyDown(Key.Up)) then self.move.x= -1 * movespeed * Time:GetSpeed() end if (self.window:KeyDown(Key.Right)) then self.move.y= movespeed * Time:GetSpeed() end if (self.window:KeyDown(Key.Left)) then self.move.y= -1 * movespeed * Time:GetSpeed() end self.entity:AddForce(self.move.x,0,self.move.z) self.entity:AddTorque(0,self.move.y,0) Time:Update() end Does someone have some tips?
-
I have same soon as I step in to collision box I crash.
-
Sound great!!!
-
Are shaders available for LE3 now?
DanceTweety replied to karmacomposer's topic in General Discussion
I hope there will be at least some good ocean water and a Reflect shader for us of cubemaps that you can tell how refletive it should be. -
I dont see it in leadwerks 3.1 where is it?