Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
7 scripts/b2rexpkg/b25/app.py
@@ -253,16 +253,19 @@ def _processPosCommand(self, obj, objId, pos):
def getObjectProperties(self, obj):
rot = obj.rotation_euler
- if obj.opensim.uuid in self.Agents:
- rot = [rot[0]-math.pi/2.0, rot[1], rot[2]+math.pi/2.0]
+ #if obj.opensim.uuid in self.Agents:
+ # rot = [rot[0]-math.pi/2.0, rot[1], rot[2]+math.pi/2.0]
return (obj.location, rot, obj.scale)
def _processRotCommand(self, obj, objId, rot):
+ """
if objId in self.Agents:
rot = self._apply_rotation(rot)
obj.rotation_euler = (rot[0]+math.pi/2.0, rot[1], rot[2]-math.pi/2.0)
else:
self.apply_rotation(obj, rot)
+ """
+ self.apply_rotation(obj, rot)
self.rotations[objId] = list(obj.rotation_euler)
def applyObjectProperties(self, obj, pars):
View
16 scripts/b2rexpkg/editsync/handlers/agents.py
@@ -9,6 +9,7 @@
import bpy
import b2rexpkg
+import math
class AgentsModule(SyncModule):
_agents = {}
@@ -60,15 +61,24 @@ def getAgent(self, agentID):
editor = self._parent
agent = editor.findWithUUID(agentID)
if not agent:
+ objects = set(list(bpy.data.objects))
+ bpy.ops.mesh.primitive_cube_add()
+ objects2 = set(list(bpy.data.objects))
+ agent = list(objects2.difference(objects))[0]
+ agent.name = agentID
camera = bpy.data.cameras.new(agentID)
- agent = bpy.data.objects.new(agentID, camera)
+ camera_obj = bpy.data.objects.new('cam_'+agentID, camera)
+ scene = editor.get_current_scene()
+ scene.objects.link(camera_obj)
+ camera_obj.location = (1.0, 0.0, 1.0)
+ camera_obj.rotation_euler = (math.pi/2.0, 0.0, -math.pi/2.0)
+ camera_obj.parent = agent
editor.set_uuid(agent, agentID)
self._agents[agentID] = agentID
- scene = editor.get_current_scene()
if agentID in editor.positions:
editor.apply_position(agent, editor.positions[agentID], raw=True)
- scene.objects.link(agent)
+ #scene.objects.link(agent)
b2rexpkg.editor.set_loading_state(agent, 'OK')
try:
agent.show_name = True
View
22 scripts/b2rexpkg/editsync/handlers/game.py
@@ -53,6 +53,7 @@ def processControls(self):
sensitivity = 1.0 # mouse sensitivity
owner = G.getCurrentController().owner
+ camera = owner.children[0]
simrt = bpy.b2rex_session.simrt
session = bpy.b2rex_session
@@ -86,7 +87,7 @@ def processControls(self):
# set the values
owner.applyRotation([0, 0, x], False)
- owner.applyRotation([y, 0, 0], True)
+ camera.applyRotation([y, 0, 0], True)
_rotmat = owner.worldOrientation
print(_rotmat)
@@ -141,16 +142,21 @@ def processCommands(self):
commands = simrt.getQueue()
- print('processCommands', len(commands))
+ print('processCommands', len(commands), avatar)
for command in commands:
print(' *', command)
if command[0] == "pos":
- print("command0")
- objid = command[1]
- pos = command[2]
- if objid == session.agent_id:
- print(pos, owner.get("uuid"))
- avatar.location = session._apply_position(pos)
+ self.processPosition(owner, *command[1:])
+
+ def processPosition(self, owner, objid, pos, rot=None):
+ session = bpy.b2rex_session
+ if objid == session.agent_id:
+ print(pos, owner.get("uuid"))
+ owner.worldPosition = session._apply_position(pos)
+ if rot:
+ b_q = mathutils.Quaternion((rot[3], rot[0], rot[1], rot[2]))
+ owner.worldOrientation = b_q
+
def ensure_game_uuid(self, context, obj):
"""

No commit comments for this range

Something went wrong with that request. Please try again.