Jump to content

Kicking Boxes


Yue
 Share

Recommended Posts

I'm confused, the translator doesn't help much, the help says that the first three parameters are to apply force, the rest is the position of some entity, but this continues to release the box sometimes correctly and sometimes incorrectly.

 

 

Link to comment
Share on other sites

No work. :(

 

function Script:UpdateWorld()

	local mundo = World:GetCurrent()
	local ventana = Window:GetCurrent()

	local pick = PickInfo()
	col = mundo:Pick(self.player:GetPosition(true), Vec3(self.entity:GetPosition(true).x, self.entity:GetPosition(true).y,self.entity:GetPosition(true).z),pick, 0, false )

	local anglePlayer = self.player:GetRotation(true).y
	local xP = Math:Sin(anglePlayer)
	local zP = Math:Sin(anglePlayer)


	if col then 

		if pick.entity:GetKeyValue("name") == "Caja" then
		   pick.entity:SetDamping(0,0)
		   pick.entity:SetFriction(100,100)
			if ventana:KeyHit(Key.E ) then 
			pick.entity:AddPointForce( pick.entity:GetPosition(), Vec3(xP,0,zP), true)
			--pick.entity:AddForce(Vec3(0,0,1000),false)
			--pick.entity:SetOmega(Vec3(0,0,0))
			end 
		end 
	end 

	
	System:Print(xP)
	

 

 

 

Link to comment
Share on other sites

local force = Vec3(0, 0, 1)
force = Transform:Vector(force, self.entity, nil)
pick.entity:AddPointForce(pick.entity:GetPosition(), force)

 

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

16 minutes ago, Josh said:

local force = Vec3(0, 0, 1)
force = Transform:Vector(force, self.entity, nil)
pick.entity:AddPointForce(pick.entity:GetPosition(), force)

 

Unbelievable, if it works, the most horrible confusion is that first goes Force and then position.  That's what the help says.  Today I will be able to sleep peacefully. 
Thanks You!!

Resultado de imagen para logo trofeo

function Script:UpdateWorld()

	local mundo = World:GetCurrent()
	local ventana = Window:GetCurrent()

	local pick = PickInfo()
	col = mundo:Pick(self.player:GetPosition(true), Vec3(self.entity:GetPosition(true).x, self.entity:GetPosition(true).y,self.entity:GetPosition(true).z),pick, 0, false )

	local force = Vec3(0, 500, -10500)
	force = Transform:Vector(force, self.player, nil)

	if col then 

		if pick.entity:GetKeyValue("name") == "Caja" then
		   pick.entity:SetDamping(0,0)
		   pick.entity:SetFriction(100,100)
			if ventana:KeyHit(Key.E ) then 
			pick.entity:AddPointForce( force,pick.entity:GetPosition(true))
	
			end 
		end 
	end 

	
	
	
end

 

 

Link to comment
Share on other sites

It might make more sense to just use AddForce. I mean, the player just wants the box to go forward. They aren't going to be thinking about what point on the box they are kicking.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

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...