Exemple #1
0
    def build_social_vehicle(self,
                             sim,
                             vehicle_state,
                             actor_id,
                             vehicle_type,
                             vehicle_id=None):
        if vehicle_id is None:
            vehicle_id = gen_id()

        vehicle = Vehicle.build_social_vehicle(sim, vehicle_id, vehicle_state,
                                               vehicle_type)

        vehicle_id, actor_id = _2id(vehicle_id), _2id(actor_id)
        if sim.is_rendering:
            vehicle.create_renderer_node(sim.renderer)
            sim.renderer.begin_rendering_vehicle(vehicle.id, is_agent=False)

        self._vehicles[vehicle_id] = vehicle
        self._2id_to_id[vehicle_id] = vehicle.id
        entity = _ControlEntity(
            vehicle_id=vehicle_id,
            actor_id=actor_id,
            actor_type=_ActorType.Social,
            shadow_actor_id="",
            is_boid=False,
            is_hijacked=False,
            position=vehicle.position,
        )
        self._controlled_by = np.insert(self._controlled_by, 0, tuple(entity))

        return vehicle
Exemple #2
0
    def build_social_vehicle(self,
                             sim,
                             vehicle_state,
                             actor_id,
                             vehicle_type,
                             vehicle_id=None):
        if vehicle_id is None:
            vehicle_id = gen_id()

        vehicle = Vehicle.build_social_vehicle(sim, vehicle_id, vehicle_state,
                                               vehicle_type)

        vehicle_id, actor_id = _2id(vehicle_id), _2id(actor_id)
        vehicle.np.reparentTo(sim._root_np)

        self._vehicles[vehicle_id] = vehicle
        self._2id_to_id[vehicle_id] = vehicle.id
        entity = _ControlEntity(
            vehicle_id=vehicle_id,
            actor_id=actor_id,
            actor_type=_ActorType.Social,
            shadow_actor_id="",
            is_boid=False,
            is_hijacked=False,
            position=vehicle.position,
        )
        self._controlled_by = np.insert(self._controlled_by, 0, tuple(entity))

        return vehicle
Exemple #3
0
    def build_social_vehicle(self,
                             sim,
                             vehicle_state,
                             actor_id,
                             vehicle_type,
                             vehicle_id=None):
        if vehicle_id is None:
            vehicle_id = str(gen_id())

        vehicle = Vehicle.build_social_vehicle(sim, vehicle_id, vehicle_state,
                                               vehicle_type)
        vehicle.np.reparentTo(sim._root_np)

        self._vehicles[vehicle.id] = vehicle
        self._controlled_by = np.insert(
            self._controlled_by,
            0,
            (vehicle.id, actor_id, _ActorType.Social, ""),
        )

        return vehicle
Exemple #4
0
    def build_social_vehicle(self,
                             sim,
                             vehicle_state,
                             actor_id,
                             vehicle_type,
                             vehicle_id=None):
        if vehicle_id is None:
            vehicle_id = str(gen_id())

        vehicle = Vehicle.build_social_vehicle(sim, vehicle_id, vehicle_state,
                                               vehicle_type)
        vehicle.np.reparentTo(sim._root_np)

        self._vehicles[vehicle.id] = vehicle
        entity = _ControlEntity(
            vehicle_id=vehicle.id,
            actor_id=actor_id,
            actor_type=_ActorType.Social,
            shadow_actor_id="",
            is_boid=False,
        )
        self._controlled_by = np.insert(self._controlled_by, 0, tuple(entity))

        return vehicle