addObject not working properly (python)


I have this code and it’s not working properly

It triggers and according to the print() it creates the object, but it’s invisible in the game.

this is the code:

import bgeimport random
from bge import logic

def create(cont):
    scn = logic.getCurrentScene()
    plane = scn.objects['trigger_p'] 
    cont = logic.getCurrentController()
    own = cont.owner
    ray = cont.sensors["Ray"]
    if ray.positive:
       newPlane = scn.addObject("P"+str(rand), plane, 500)
       plane.localPosition.y = plane.localPosition.y + 300
       MAX_PLANES = 2
       rand = random.randint(1, MAX_PLANES)
       orientation = newPlane.orientation.to_euler()
       orientation.x = 0

and according to print(newPlane.localPosition) this newPlane has a location, which should mean that it exists right?
I just don’t see it in-game

Thanks in advance,

Check that the object your adding is actually visible (just move it to an active layer where you can see it and start the game). Added objects copy the orientation and scaling of the object they are added at (in this case the plane object), so make sure those have proper values. Note that you can only see a plane from one side in the BGE. The normal must be facing the camera.

If this is for your Particle System with Halos or Billboards, be sure to align the Plane towards the right Axis in Edit Mode. (I am never sure which Axis that is, silly me.^^)
(On another Hand I guess you have made that sure before integrating the Script, so my Notion might be worthless.)