Hello,
I am trying to create a separate code where if the “ExactWeightOnly” is turned on, the weight must be exactly what is floated, otherwise the door will react to the trigger.
I went through this as carefully as I can to try to locate the problem, it is the “==” operators that seem to be the problem. I the bool works, the other code “>” or “<” works (this is dealing with not needing an exact weight). But nothing happens with “==”.
Here is my code:
void UOpenDoor::AutoDoorSequencer(float DeltaTime)
{
ExactWeightOnly;
if (!ExactWeightOnly)
{
if (!OpenDoorTrigger) {return;}
if (OpenTotalMassOfActors() > MassPressureForDoor)// if accumalitive weight is this, not just player.
{
OpenDoor(DeltaTime);// passing in DeltaTime, which is framerate.
DoorLastOpened = GetWorld()->GetTimeSeconds();// will start a timer counting when the door opens.
//DoorLastOpened = when the door was opened
}
else// if not on the trigger
{
// Minus the GetTimeSeconds (is current time) by DoorLastOpen, and then check to
// see if the remainder is greater than doorclosedelay. If so, close it.
if (GetWorld()->GetTimeSeconds() - DoorLastOpened > DoorCloseDelay)
{
CloseDoor(DeltaTime);
}
}
}
else
{
if (!OpenDoorTrigger){return;}
if (OpenTotalMassOfActors() == MassPressureForDoor)
{
OpenDoor(DeltaTime);
DoorLastOpened = GetWorld()->GetTimeSeconds();
}
else
{
if (OpenTotalMassOfActors() > MassPressureForDoor || OpenTotalMassOfActors() < MassPressureForDoor)// greater or less than equal?
{
if (GetWorld()->GetTimeSeconds() - DoorLastOpened > DoorCloseDelay)
{
CloseDoor(DeltaTime);
}
}
}
}
}
Besides the equal sign, everything is working. If I switch the roles of the “ExactWeightOnly” bool, so that when on it compares using “>” instead of “==” it works. Thus I find when the “==” does the code stop working.
Or maybe there is an issue within the EU editor that I am not aware of. Maybe my objects are not interacting correctly? Somehow the weight of the object is not exact despite what is typed in. No clue.