Gremlin movement #85
Replies: 1 comment
-
|
Please refer to this file and reimplement these functions. def move(self):
"""Set mocap object positions before a physics step is executed."""
phase = float(self.engine.data.time)
for i in range(self.num):
name = f'gremlin{i}'
target = np.array([np.sin(phase), np.cos(phase)]) * self.travel
pos = np.r_[target, [self.size]]
self.set_mocap_pos(name + 'mocap', pos)
def get_obj(self, xy_pos, rot):
"""To facilitate get objects config for this object"""
body = {
'name': self.name,
'pos': np.r_[xy_pos, self.size],
'rot': rot,
'geoms': [
{
'name': self.name,
'size': np.ones(3) * self.size,
'type': 'box',
'density': self.density,
'group': self.group,
'rgba': self.color * np.array([1, 1, 1, self.alpha]),
},
],
}
if self.is_meshed:
body['geoms'][0].update(
{
'type': 'mesh',
'mesh': self.mesh_name,
'material': self.mesh_name,
'rgba': np.array([1, 1, 1, 1]),
'euler': [np.pi / 2, 0, 0],
},
)
body['pos'][2] = 0.0
return body
def get_mocap(self, xy_pos, rot):
"""To facilitate get mocaps config for this object"""
body = {
'name': self.name,
'pos': np.r_[xy_pos, self.size],
'rot': rot,
'geoms': [
{
'name': self.name,
'size': np.ones(3) * self.size,
'type': 'box',
'group': self.group,
'rgba': self.color * np.array([1, 1, 1, self.alpha * 0.1]),
},
],
}
if self.is_meshed:
body['geoms'][0].update(
{
'type': 'mesh',
'mesh': self.mesh_name,
'material': self.mesh_name,
'rgba': np.array([1, 1, 1, 0]),
'euler': [np.pi / 2, 0, 0],
},
)
body['pos'][2] = 0.0
return body |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
When Gremlins are added to an environment, they all spin in the same direction, at the same time, at the same velocity. I was wondering if there was any possible way to change this so some spun quicker or at least in a different direction?
~ Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions