• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Start
  • Kontakt
    • Made in Vorarlberg
  • Leistungen
    • Web Development
    • Enterprise React-Native App Entwicklung
    • Embedded Systems
    • Java Entwicklung
    • C++ Entwicklung
  • Referenzen
    • Kunden
    • Webdesign & Webapps
    • Mobile Apps
    • Embedded Systems
    • Cloud Apps
  • Neuigkeiten
    • We’re hiring

Search

Anagram Engineering

Webdesign und Softwarelösungen aus Vorarlberg. Ihr Partner für innovative Lösungen rund ums Internet. Full Service Agentur.

Juni 24, 2014 by Harald

Move Objects in Blender Game Engine

This article describes a way to „pick and move objects“ in Blender Game Engine.

Unfortunately a lot of published code is not working with the current version of Blender or depends on specific objects within the scene.

I wrote the code to try some 3D Collision Shapes. In order to do that, i wanted to have the objects movable to see how they interact with other objects.

Let me know if you see any improvements and leave a comment if it’s useful for you.

The code does the following:

  • pick an object with left or right mouse click
  • move it as long as the mouse is clicked, release it otherwise
  • move on x/y plane with LMB, move on y/z plane with RMB

Currently i’m fine with moving them with 3DOF, so i can move them in X,Y and Z direction.

I have written this little script, which is triggered by MouseOverAny, Left Mouse Button Click and Right Mouse Button Click.

I’ve assigned the sensors to the camera, which i thought is probably the only object that will stay within the scene.

import bge

cont = bge.logic.getCurrentController()
LMB = cont.sensors["LMB"]
RMB = cont.sensors["RMB"]
if LMB.positive | RMB.positive:    
    mouseOver = cont.sensors["MouseOver"]
    obj = mouseOver.hitObject
    mouseX = mouseOver.hitPosition[0]
    mouseY = mouseOver.hitPosition[1]
    mouseZ = mouseOver.hitPosition[2]

    if LMB.positive: 
        obj.position[0] = mouseX
        obj.position[1] = mouseY
    if RMB.positive:
        obj.position[1] = mouseY
        obj.position[2] = mouseZ

The assignments can be seen here:

BlenderMovingObjectsLogicEditor

As i’ve received some good information through YouTube videos, let me know if anyone is interested in seeing some videos from Anagram as well.

I’ve added a linked object and want to move it. How can I do?

If you want to move linked objects, you have to make them a proxy.

CTRL + ALT + P

will do so.

Kategorie: Neuigkeiten Stichworte: 3D, blender, game engine, python

Über Harald Entner

Harald Entner ist seit Januar 2013 Geschäftsführer von Anagram Engineering.

Nachdem er sein Informatikstudium an der Technischen Universität Wien abgeschlossen hat, war er in Wien, München und Dornbirn als Softwareentwickler, Softwarearchitekt und Systementwickler tätig.

Harald war Supporter des Apache Cocoon Projekts
und Mitglied des Consortium and Laboratory on Advanced Robotics Architectures an der TU-Wien.

Heute reist er gerne durch die Welt, lernt neue Sprachen und läuft und wandert durch die Wälder und Gebirge Vorarlbergs. Er spielt gerne Schach (zumeist die Abtauschvariante der Spanischen Partie).

Als Consultant unterstützt Harald Firmen bei der Wahl von Frameworks, Sprachen und Umgebungen .

Haupt-Sidebar (Primary)

Letzte Beiträge

  • Zumtobel PROset App | Rebranding Februar 3, 2021
  • Speed matters Juli 2, 2019
  • Vienna calling Juni 18, 2019
  • Resclite Pro April 12, 2019
  • Zumtobel PROset App April 10, 2019

Footer

Kontaktieren Sie uns

Stiegstrasse 24
6830 Rankweil
Vorarlberg, Österreich

+43 650 925 62 64
hello@anagram.at

Was wir machen

Anagram Engineering befindet sich im Herzen Vorarlbergs.

Wir beschäftigen uns mit der Softwareentwicklung für Web, Mobile, und eingebettete Systeme.

Wir erstellen Websites und Desktopsoftware für Microsoft und Linuxsysteme für Betriebe in und um Vorarlberg.

Als Consultants helfen wir Industrieunternehmen bei der Wahl von Softwareframeworks und dem Aufbau von sauberen Softwarearchitekturen.

Erfahren Sie mehr

© 2026 · Anagram Engineering

  • AGB
  • Datenschutz
  • Impressum
  • Kunden
  • Referenzen
  • Kontakt
  • Deutsch
  • English