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

Dalai Felinto dfelinto at gmail.com
Tue Aug 12 03:56:34 CEST 2008


Finally I figure out a way to make it work.
The track for the initial delay for the always sensor is here:

http://projects.blender.org/tracker/?func=detail&atid=127&aid=17472&group_id=9

The only thing I still can't solve is the readfile.c
So if you open a file that already have an always sensor it doesn't
work properly.

You need to change the sensor type and then assign it as an
AlwaysSensor. After that you can save and open your files normally.

I would appreciate some feedback  :D
(and also some help in the readfile.c)

Cheers,
Dalai


2008/8/1 Dalai Felinto <dfelinto at gmail.com>:
> 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