Jump to content

My logic doesn't work


Yue
 Share

Recommended Posts

self.pickinfo = PickInfo()
	self.colision = self.mundo:Pick(self.pivotP:GetPosition(true), Vec3(self.pivotP:GetPosition(true).x,self.pivotP:GetPosition(true).y-0.65,self.pivotP:GetPosition(true).z), self.pickinfo,0.5, false)
 
		self.jump = 0.0
		

	if self.ventana:KeyHit(Key.Space) then 
		if self.colision then
			self.jump = 8
		end
	end

	if self.colision then 
		aire = false
		posPlayer = self.entity:GetPosition(false) 
	
	else
		aire = true 
		posPlayer_Aire = self.entity:GetPosition(false)

		if posPlayer_Aire.y  <=  -10 + posPlayer.y    then 
			infoAire  = "Juju"
			self.entity:SetPosition(posPlayer.x, posPlayer.y, posPlayer.z-10,false) -- <<< Here!, 
	
		end 

	end 

The previous code in Lua script, has as objective that when the player falls to the void from the platform he returns it to the point where the fall starts, on the same platform. All works well if the player before reaching the edge jumps and goes to the void, however if the player does not jump, and runs to the edge, goes to the void and is at the point where the fall begins, nothing is left over, and falls again and again.

According to my game logic, I have to position the player in the z position locally, but with an added value towards his back so that it remains on the platform, but it doesn't work, even if it puts False or True in the global or local coordinate system, it doesn't work. 

Any suggestions?

Translated with www.DeepL.com/Translator

image.thumb.png.9282716a20adc964ca07fff1879f1ff2.png

 

 

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