please!!! is there any way to add an ‘x-ray’ script to an object making it maybe miles away from the camera but appearing in front of everything? can someone submit a script?
HELP!!!
please!!! is there any way to add an ‘x-ray’ script to an object making it maybe miles away from the camera but appearing in front of everything? can someone submit a script?
HELP!!!
There’s an actuator called OverlayScene. You can place objects in a different scene, and in the main scene with the game logic you add the logic bricks for overlay scene. Those objects in the 2nd scene could be linked in from the main scene, so they will in both scenes sharing same location
that would work except the object i need to overlay is tightly tied to other objects with parents and vertex parents and so forth. if someone could just write a script that makes the BGE draw all of a certian objects vertices in front, when really they are behind something else.
Make a duplicate of the object in an Overlay Scene, and use python to copy the position so it matches the original.
i can’t script in python. i don’t know how to. and when i have done scripting in other game design programs my codes never work.
I see you have no clue about scripting.
Are you really using multiple game engines at the same time?
You have to deside where you want to start, to learn programming. Python is a good choice.
Whatever you learn, you can translate this into other programming languages.
Anyway here is a code:
call the file Utils.py
registration = {}
def getObject(cont, propName):
''' Returns the object registered under the
key in property propName'''
try:
sourceKey = cont.owner[propName]
except KeyError:
print "Error: no string property '"+propName+"' with the registered key of the source object found."
return None
try:
source = registration[sourceKey]
except KeyError:
print "Error: Object with key",sourceKey,"not registered"
return None
if source.invalid:
print "Object",source,"does not exist anymore"
return None
return source
def register(cont):
''' Registers itself at this module under the key in property "register".'''
if not cont.sensors[0].positive:
return
try:
key = cont.owner["register"]
except KeyError:
print "Error: No string property 'register' with a key found."
return
registration[key] = cont.owner
def copyPos(cont):
''' Copies the world position from the object registered under the
key in property "source" to this object'''
if not cont.sensors[0].positive:
return
source = getObject(cont, "source")
if source == None:
return
# the most important code
cont.owner.worldPosition = source.worldPosition
def copyOri(cont):
''' Copies the world orientation from the object registered under the
key in property "source" to this object'''
if not cont.sensors[0].positive:
return
source = getObject(cont, "source")
if source == None:
return
# the most important code
cont.owner.worldOrientation = source.worldOrientation
def copyScale(cont):
''' Copies the world orientation from the object registered under the
key in property "source" to this object'''
if not cont.sensors[0].positive:
return
source = getObject(cont, "source")
if source == None:
return
# the most important code
cont.owner.localScale = source.localScale
def copyAll(cont):
''' Copies the world position, orientation and scaling from the object registered under the
key in property "source" to this object'''
if not cont.sensors[0].positive:
return
source = getObject(cont, "source")
if source == None:
return
# the most important code
cont.owner.localScale = source.localScale
cont.owner.worldOrientation = source.worldOrientation
cont.owner.worldPosition = source.worldPosition
Just typed it in.
There is a lot of error handling. That makes the code look huge.
Here is how to use it:
The scene you want to copy from, the source object:
register it at the script:
Property:
String, register, orig
Always sensor (no pulses!) -> python Module controller: Utils.register
The scene you want to copy to, the target object:
String, source, orig
Always sensor (True puls) -> python Module controller: Utils.copyPos
You will see that is ONLY copies the position. So you get some more functions:
Remarks:
If it does not work, check the console. It should tell you what is missing.
Oh, do not forget to add the overlay scene, or to switch to the main scene when starting the GE. You can change “orig” to anything you want, but change it on both objects.
More usage:
If you want to have another pair of objects, do the same, but use another key (e.g “orig2”).
You can copy the same attributes from one object to multiple other objects, by using the same key (“orig”). This allows that one object copies the position while another one copies the orientation etc.
Thankyou Very much!!! that is very helpful!
is there a chance i could see your blend file? the file u used to make the script? please?
it would help a lot.
Thanks. - Ryley
Sure,
I thought the pictures of the logic bricks would be enough. That forces you to set it up once. That could help to understand what it does.
CopyBetweenScenes.blend (151 KB)