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