Jump to content

Brutile

Members
  • Posts

    314
  • Joined

  • Last visited

Posts posted by Brutile

  1. I'm impressed! Really atmospheric ;)

    That old man was creepy. He just appeared out of nowhere. Was not expecting it at all.

    Is there a way past the path as you follow the man? He got to the end and disappeared and there was an invisible wall blocking me.

  2. I decided to make a mini golf game for the game tournament, but I'm being haunted by some physics bug. I have a ball that is 0.1 scale and after it gets hit, once it gets to a specific point, it falls throught the floor. It happens without fail. The hotspot seems to be in the middle of the CSG where the two triangles meet. Even when I scale the ball to 1, it doesn't fall through the floor, but it does hit a bump and put it off course.

     

    Here's my script in case you can see anything that might be wrong.

     

    Script.mouseSensitivity = 2.0
    Script.camOffset = Vec3(0, 1, -3)
    Script.camSmoothing = 10.0
    Script.hitForce = 350
    function Script:Start()
    --initialize camera
    self.camera = Camera:Create()
    self.camera:SetFOV(70)
    self.camera:SetRange(0.05, 1000)
    self.camera:SetMultisampleMode((System:GetProperty("multisample", "4")))
    self.camera:SetRotation(self.entity:GetRotation(true))
    self.camera:SetPosition(self.entity:GetPosition(true) + self.camOffset)
    --add listener as camera
    self.listener = Listener:Create(self.camera)
    --create player model
    self.entity:SetPosition(self.entity:GetPosition(true) + Vec3(0, 0.1, 0), true)
    self.model = Model:Sphere()
    self.model:SetScale(0.1, 0.1, 0.1)
    self.model:SetPosition(self.entity:GetPosition(true), true)
    self.model:SetParent(self.entity)
    self.model:SetColor(1,1,1)
    --setup ball physics
    self.entity:SetMass(1)
    self.entity:SetFriction(0.1, 0.1)
    self.entity:SetSweptCollisionMode(true)
    --Create a shape
    local shape = Shape:Sphere(0,0,0, 0,0,0, 0.1,0.1,0.1)
    self.entity:SetShape(shape)
    shape:Release()
    --set collision type of player
    self.entity:SetCollisionType(Collision.Prop)
    local window = Window:GetCurrent()
    local context = Context:GetCurrent()
    window:SetMousePosition(Math:Round(context:GetWidth() / 2), Math:Round(context:GetHeight() / 2))
    
    self.mouseDifference = Vec3(0, 0, 0)
    self.camRotation = Vec3(0, 0, 0)
    self.camera:SetRotation(self.camRotation)
    end
    function Script:UpdateWorld()
    local window = Window:GetCurrent()
    local context = Context:GetCurrent()
    --mouse look
    self.currentMousePos = window:GetMousePosition()
    window:SetMousePosition(Math:Round(context:GetWidth() / 2), Math:Round(context:GetHeight() / 2))
    self.currentMousePos.x = Math:Round(self.currentMousePos.x)
    self.currentMousePos.y = Math:Round(self.currentMousePos.y)
    self.mouseDifference.x = Math:Curve(self.currentMousePos.x - Math:Round(context:GetWidth() / 2), self.mouseDifference.x, 3)
    self.mouseDifference.y = Math:Curve(self.currentMousePos.y - Math:Round(context:GetHeight() / 2), self.mouseDifference.y, 3)
    self.camRotation.x = Math:Clamp(self.camRotation.x + self.mouseDifference.y / self.mouseSensitivity, 0, 70)
    self.camRotation.y = self.camRotation.y + (self.mouseDifference.x / self.mouseSensitivity)
    --camera orbit around ball
    self.camera:SetRotation(self.camRotation)
    self.camera:SetPosition(self.entity:GetPosition(true), true)
    self.camera:Move(self.camOffset)
    --hit the ball
    if window:MouseHit(1) then
     local c = self.camera:GetPosition(true)
     local p = self.entity:GetPosition(true)
     local dir = p - Vec3(c.x, p.y, c.z)
     dir = dir:Normalize() * self.hitForce
     self.entity:AddForce(dir)
    end
    end
    

     

    All I did was create a new map, added a pivot at 0,0,0 with this script assigned, then created a CSG cube at pos: 0, -16, 2688 and size: 512cm, 32cm, 5888cm.

    Hit the ball without moving the mouse and it will get half way down and fall through.

    I even tried a small 512x512 floor with walls and just hit it around. Eventually it would fall through.

×
×
  • Create New...