[Bf-committers] Init Delay for BGE Sensors, ideas and support pls

Dalai Felinto dfelinto at gmail.com
Sat Aug 2 04:14:36 CEST 2008


Carsten,
thanks for your opinion.

Using the timer can be a good solution, although I still think that an
initial delay can be useful.

I'm still confused with the way SCA_AlwaysEventManager.cpp works. I
know that I can make an initial delay with I use a counter in the
NextFrame function, but right now I need to hard-code the m_initdelay:

# # # #
void SCA_AlwaysEventManager::NextFrame()
 {
  for (set<class SCA_ISensor*>::const_iterator i=
m_sensors.begin();!(i==m_sensors.end());i++)
  {
       if (m_initdelay <1){
               for (set<class SCA_ISensor*>::const_iterator i=
m_sensors.begin();!(i==m_sensors.end());i++)
               {
                       (*i)->Activate(m_logicmgr, NULL);
               }
       }else{
               m_initdelay --;
        }
 }
# # # #

If anyone can help me with this.

If my approach is right, what I need is a way to read what is the kind
of sensor I'm initializing, and if it is an Always Sensor I need to
set m_initdelay to the initdelay from the always sensors...

A small update of what I have so far:
     http://pasteall.org/1820/cpp


Thanks,
Dalai

http://blenderecia.orgfree.com


2008/7/29 Carsten Wartmann <cw at blenderbuch.de>
>
> Dalai Felinto schrieb:
> > Hi.
> >
> > We are using different sensors from different objects to initialize and
> > run some Python scripts in BGE.
> > Sometimes we need a specific script initialization order, and we are
> > having some troubles with the way Blender handle it.
> >
> > One idea we have so far was to implement an option in the Always Sensor
> > to delay the beginning of the scripts in a specific number of pulses.
>
> This feature has a (IMHO) limited use. So in the rare cases why not
> using a timer Property and a Property Sensor "sensing" the
> Timer-Property? If you need a frame based "tick" it is probably better
> to add 3 more LBs to add +1 to a property and check it for the desired
> value.
>
> Cheers,
> Carsten
>
> --
> Carsten Wartmann: Autor - Dozent - 3D - Grafik
> Homepage:         http://blenderbuch.de/
> Das Blender-Buch: http://blenderbuch.de/redirect.html
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers


More information about the Bf-committers mailing list