Hi,
I don’t understand why my code doesn’t work.
I use the library oimo.js for my physic
<!DOCTYPE html>
<html lang="en">
<head>
<title>Oimo.js Collision</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<link rel="shortcut icon" href="./assets/img/favicon.ico">
<link rel="stylesheet" href="css/demo.css">
<script src="js/demo.js"></script>
<script src="js/libs/three.min.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="../build/oimo.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>
<div id='interface'>
<input type="button" value="demo" onClick=populate(1)>
This file has been truncated. show original
What I would like :
In line 149, if there is no contact then my red cubes (class enemy) must levitate otherwise they fall on the ground and die via the “die” method
But I don’t get the expected result at all and my red cubes bounce on the ground?
Can you help me?
Thanks
1 Like
Haaaa,
After a few seconds, my red cubes (without collisions) fall to the ground! However, I have defined a y position in my loop function. Can you tell me why?
An example is better, if I set the gravity to -200, my objects fall immediately… and this is not what I want.
Could you help me to fix that ?