Hi everybody
I am trying to make the camera following an object (Cube) wich is shooted by an emitter (Empty) like a particule. The shooted object is not on the same layer with the other objects. And its layer is not enable.
It seems that the camera doesnât detect the object that it should target when itâs shooted from the emitter.
I have used the actuator âcameraâ to target the object. To shoot press âQâ
I join my blend test file where you can maybe better understand what I am explaining.
Hi BluePrintRandom,
thanks for the quick answer,great!
Iâve tried to insert the code as scripts in the python logicbricks, but it doesnât work. I think I havenât paste them at the right place.
Could you paste your scripts in the test blend file Iâve attached in my first post ? And upload its update on this Thread.
That would be very cool !
THANK YOU
Hi BluePrintRandom, thank you very much for the file !
But I think maybe I didnât explain very clearly my problem. Actualy I would like that camera also go with the cube and not only follow it like watching at it.
There this actuator logic brick âCameraâ that is actualy doing this perfectly when the followed object is allready present in the scene; but that actuator doesnât work for some reasons when the object is been added.
So what I am trying to do is this:
Hi PrintBlueRandom,
Iâve triyed to understand the scripts of your demo (actualy I am a total noob for scrpting) and it makes me understand that the camera stay focus on the position of the added object as it is placed in the inactive layer, because the camera doesnât make the difference between the original object (on inactive layer) and the added object on the active layer.
And there is no possibilities to differenciate it in the logic brick actuator âCameraâ by adding or checking a Property.
So Iâve tryied to make a script wich actualy doesnât work, but maybe it can help to understand my intention. DetectAddedAndFollow.blend (512 KB)
The Camera is linked to this script, that make it looking permanently for the added object (the object should be added only one time, so that we donât have to differenciate each added object). And when the added object is becoming true through its bollean property named âTargetâ, it become a target for the Camera which have to follow it, like the actuator logic brick âCaremaâ would do in this case.
1 when you press shoot key it adds a group object which contains a bullet and a camera parented to it(it is in hidden layer)
2 bullet camera will have an always sensor connected to scene actulator which set camera to bullet camera
3 bullet has a collision sensor (which detects if bullet collides something) which ends the bullet and send message to camera and set the original camera
4 when bullet camera recieve message it destroys itself
this may help you. press spacebar to shoot bullets and camera will follow bullet and when bullet destroys camera is back to original . oh and no python is needed at all
Thank you BluePrintRandom !
Iâve integrated the script in my blend file, but the camera still doesnât catch the added object properly. Actualy the camera is still following the object from the inactive layer, when I press SPACE. We can see that itâs trying to catch the added object. But it doesnât come close to the added Object.
Donât know why. Did I forget something maybe ? Does it depend of my blender version (I work with blender 2.67) ?
I added 2 lines (from your Demo blend file) to your code (the console showed me that is was missing):
cont = bge.logic.getCurrentController()
own = cont.owner