Jump to content

Cant find the right command to Update physics


DudeAwesome
 Share

Recommended Posts

I rotated an entity (ground) with

 

function Script:UpdateWorld()
if App.window:KeyDown(Key.L) then
rotationNow = self.entity:GetRotation()
self.entity:SetRotation(rotationNow.x,rotationNow.y,rotationNow.z-1)

System:Print("X: " ..rotationNow.x .. " Y: " ..rotationNow.y .. " Z: " ..rotationNow.z)
end

if App.window:KeyDown(Key.J) then
rotationNow = self.entity:GetRotation()
self.entity:SetRotation(rotationNow.x,rotationNow.y,rotationNow.z+1)
System:Print("X: " ..rotationNow.x .. " Y: " ..rotationNow.y .. " Z: " ..rotationNow.z)
end

if App.window:KeyDown(Key.K) then
rotationNow = self.entity:GetRotation()
self.entity:SetRotation(rotationNow.x-1,rotationNow.y,rotationNow.z)
System:Print("X: " ..rotationNow.x .. " Y: " ..rotationNow.y .. " Z: " ..rotationNow.z)
end

if App.window:KeyDown(Key.I) then
rotationNow = self.entity:GetRotation()
self.entity:SetRotation(rotationNow.x+1,rotationNow.y,rotationNow.z)
System:Print("X: " ..rotationNow.x .. " Y: " ..rotationNow.y .. " Z: " ..rotationNow.z)
end

end

 

before rotation

https://www.dropbox.com/s/wobccysass1cxtc/Screenshot%202014-01-18%2000.37.51.png

 

after rotation

https://www.dropbox.com/s/t7p73t5x9tm969f/Screenshot%202014-01-18%2000.38.19.png

 

when I have probs (like the sphere) on the ground they ignore the rotation and stay in the air until I touch them (with FPSplayer)

 

 

I think I need some kind of UpdateShape() or UpdatePhysics()

 

 

someone could tell me the right command that my props act like they should ?

It doesn´t work... why? mhmmm It works... why?

Link to comment
Share on other sites

entity:AddTorque(x,y,z) (force based)

entity:Turn(x,y,z) (not force based)

 

both are simpler than SetRotation() and SetPhysicsRotation()

 

If you are making the ball roll on the gound using keys, I'd use AddTorque, since it's physics based.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...