forked from bartvdbraak/blender
BGE: Random sensor will produce true random sequence of events when seed is set to 0 in the GUI (the actual seed value is stored in the sensor seed attribute). Positive values will use fixed pseudo random sequence.
This commit is contained in:
parent
4e3248fb91
commit
6d8d7cd768
@ -682,6 +682,11 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
if (eventmgr)
|
||||
{
|
||||
int randomSeed = blenderrndsensor->seed;
|
||||
if (randomSeed == 0)
|
||||
{
|
||||
randomSeed = (int)(kxengine->GetRealTime()*100000.0);
|
||||
randomSeed ^= (intptr_t)blenderrndsensor;
|
||||
}
|
||||
gamesensor = new SCA_RandomSensor(eventmgr, gameobj, randomSeed);
|
||||
}
|
||||
}
|
||||
|
@ -1770,6 +1770,11 @@ double KX_KetsjiEngine::GetClockTime(void) const
|
||||
return m_clockTime;
|
||||
}
|
||||
|
||||
double KX_KetsjiEngine::GetRealTime(void) const
|
||||
{
|
||||
return m_kxsystem->GetTimeInSeconds();
|
||||
}
|
||||
|
||||
void KX_KetsjiEngine::SetAnimFrameRate(double framerate)
|
||||
{
|
||||
m_anim_framerate = framerate;
|
||||
|
@ -271,6 +271,7 @@ public:
|
||||
*/
|
||||
double GetClockTime(void) const;
|
||||
|
||||
double GetRealTime(void) const;
|
||||
/**
|
||||
* Returns the difference between the local time of the scene (when it
|
||||
* was running and not suspended) and the "curtime"
|
||||
|
Loading…
Reference in New Issue
Block a user