I have a moving model on my terrain, when it collides while climbing on what i sculped or another entity, they bounce back, how can i prevent from doing that?
Thanks
x=0;y=0;z=-20;
camx=-5;camy=20;camz=-15;
camrx=45;camry=15;camrz=0;
function App:Start()
--Initialize Steamworks (optional)
Steamworks:Initialize()
--Set the application title
self.title="Test"
--Create a window
local windowstyle = window.Titlebar
if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
self.window=Window:Create(self.title,0,0,System:GetProperty("screenwidth","1280"),System:GetProperty("screenheight","720"),windowstyle)
self.window:HideMouse()
--Create the graphics context
self.context=Context:Create(self.window,0)
if self.context==nil then return false end
--Create a world
self.world=World:Create()
self.world:SetLightQuality((System:GetProperty("lightquality","1")))
--Load a map
local mapfile = System:GetProperty("map","Maps/test.map")
if Map:Load(mapfile)==false then return false end
self.model={}
self.model[0] = Model:Load("testmodel.mdl")
self.model[0]:SetScale(0.05);
self.model[0]:SetPosition(x,y,z);
self.model[0]:SetMass(1);
self.model[0]:SetCollisionType(Collision.Prop);
self.model[1] = Model:Load("testmodel.mdl")
self.model[1]:SetScale(0.05);
self.model[1]:SetPosition(x+15,y,z-15);
self.model[1]:SetMass(1);
self.model[1]:SetCollisionType(Collision.Prop);
self.model[0]:SetShape(Shape:Box(6.81,48.805,-7.7830, 0,0,0, 49.809,98.074,42.164))
self.model[1]:SetShape(self.model[0]:GetShape())
self.camera = Camera:Create();
self.camera:SetPosition(camx+x,camy+y,camz+z);
self.camera:SetRotation(camrx,camry,camrz);
return true
end
function App:Loop()
--If window has been closed, end the program
if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end
local run=0;
local rot=0;
if self.window:KeyDown(Key.Left) then
x=x-0.15;
rot=-180;
run=1;
end
if run==1 then
self.model[0]:PhysicsSetPosition(x,y,z,0.5)
--self.model[0]:SetPosition(x,y,z);
self.camera:SetPosition(camx+x,camy+y,camz+z);
self.model[0]:SetAnimationFrame(Time:GetCurrent()/40.0,1,"Run")
self.model[0]:SetRotation(Vec3(0,rot,0));
end
--Update the app timing
Time:Update()
--Update the world
self.world:Update()
--Render the world
self.world:Render()
--Refresh the screen
self.context:Sync(true)
--Returning true tells the main program to keep looping
return true
end