The first problem was hardly solved. The next one is already around the corner.
I move my entity with the ApplyEntityImpulse () command. It works as it should. In addition, the entity is set with the RotateEntity (). The entity moves faster through the room. However, the linear speed does not change. The distance covered simply increases. This is visually noticeable through faster movement. The faster the linear speed, the greater the effect.Every 5 frames I calculate the distance covered. And that confirms this behavior.
Any ideas??
The distance covered in space changes when rotating with RotateEntity ()
The distance covered in space changes when rotating with RotateEntity ()
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
- pf shadoko
- Enthusiast
- Posts: 290
- Joined: Thu Jul 09, 2015 9:07 am
Re: The distance covered in space changes when rotating with RotateEntity ()
I didn't understand your explanations
that said, personally, (but I may be wrong), when I use physics on an entity, I only use physiqye (no moveentity, rotateentity, ...)
(I don't know how the physics engine handles this double constraint)
to rotate you can use ApplyEntityTorque
but it's more complicated to manage
it's up to you
that said, personally, (but I may be wrong), when I use physics on an entity, I only use physiqye (no moveentity, rotateentity, ...)
(I don't know how the physics engine handles this double constraint)
to rotate you can use ApplyEntityTorque
but it's more complicated to manage
it's up to you
Re: The distance covered in space changes when rotating with RotateEntity ()
Hello, there is no one here who can tell me why when mixing physics motion with rotate functions. The effective distance covered is greater? And how can that be prevented?
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
- pf shadoko
- Enthusiast
- Posts: 290
- Joined: Thu Jul 09, 2015 9:07 am
Re: The distance covered in space changes when rotating with RotateEntity ()
Can you make a minimal example where your problem appears?
Re: The distance covered in space changes when rotating with RotateEntity ()
I am looking for an example.
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Re: The distance covered in space changes when rotating with RotateEntity ()
With this code section I calculate the distance covered every 5 frames.
And with that I control the ship in 3D space
I'll see if I can get my program cut down so that I can post it
Code: Select all
;- Kalkulation der zurück gelegten Streck
If CalkCount < 5 ;-- Durchlaufzähler für CalkCount
CalkCount = CalkCount + 1
Else
CalkCount = 1
EndIf
If CalkCount = 1 ;-- Die Start Position wird gespeichert
Define p_posx1.f = EntityX(ObjAnkerPlayer)
Define p_posy1.f = EntityY(ObjAnkerPlayer)
Define p_posz1.f = EntityZ(ObjAnkerPlayer)
;ElseIf CalkCount = 2
ElseIf CalkCount = 5
Define p_posx2.f = EntityX(ObjAnkerPlayer)
Define p_posy2.f = EntityY(ObjAnkerPlayer)
Define p_posz2.f = EntityZ(ObjAnkerPlayer)
GeflogeneDistance.f = Sqr(Pow( p_posx1.f - p_posx2.f ,2) + Pow( p_posy1.f - p_posy2.f ,2) + Pow( p_posz1.f - p_posz2.f ,2)) ;-- Distanz berechnung zwischen 2 Frames
Debug StrF(GeflogeneDistance.f)
;-- Hier wird die Vektor geschwindigkeit auf 0 gesetzt.
; Füe alle Richtungen. Wenn die zurückgelegte Entfernung pro abtastung
; kleiner ist ols 0.001 , somit kann absuluter Stilstand erreicht werden.
If GeflogeneDistance.f < 0.001
EntityVelocity(ObjAnkerPlayer,0,0,0)
EndIf
EndIf
Code: Select all
;- >> PROVISORISCH KAMERA STEUERUNG
If KeyboardPushed(#PB_Key_Pad7) : RotateNode(cameraAnkerY,0,-0.5,0,#PB_Relative) : EndIf
If KeyboardPushed(#PB_Key_Pad9) : RotateNode(cameraAnkerY,0,0.5,0,#PB_Relative) : EndIf
If KeyboardPushed(#PB_Key_Pad8) : RotateNode(cameraAnkerX,-0.5,0,0,#PB_Relative) : EndIf
If KeyboardPushed(#PB_Key_Pad5) : RotateNode(cameraAnkerX,0.5,0,0,#PB_Relative) : EndIf
;- << PROVISORISCH ENDE
If ImSchiff = 0 ;- Der Spieler ist nicht im Schiff ( Aussenansicht Steuerung )
If KeyboardPushed(#PB_Key_A) : RotateEntity(ObjAnkerPlayer,0,0,0.3,#PB_Relative ) : EndIf
If KeyboardPushed(#PB_Key_D) : RotateEntity(ObjAnkerPlayer,0,0,-0.3,#PB_Relative ): EndIf
If KeyboardPushed(#PB_Key_W) : RotateEntity(ObjAnkerPlayer,0.3,0,0,#PB_Relative ) : EndIf
If KeyboardPushed(#PB_Key_S) : RotateEntity(ObjAnkerPlayer,-0.3,0,0,#PB_Relative ): EndIf
ShipSpeed = 0
Else ;- Der Spieler ist im Schiff ( Schiff Stuern )
If KeyboardPushed(#PB_Key_A) : RotateEntity(ObjAnkerPlayer,0,0,0.3,#PB_Relative ) : EndIf
If KeyboardPushed(#PB_Key_D) : RotateEntity(ObjAnkerPlayer,0,0,-0.3,#PB_Relative ): EndIf
If KeyboardPushed(#PB_Key_W) : RotateEntity(ObjAnkerPlayer,0.3,0,0,#PB_Relative ) : EndIf
If KeyboardPushed(#PB_Key_S) : RotateEntity(ObjAnkerPlayer,-0.3,0,0,#PB_Relative ): EndIf
EndIf
If KeyboardPushed(#PB_Key_Add) ;- Schiff Beschleunigen in sicht richtung
ShipSpeed = ShipSpeedMax.f
ApplyEntityImpulse(ObjAnkerPlayer,EntityDirectionX(ObjAnkerPlayer)*ShipSpeed,EntityDirectionY(ObjAnkerPlayer)*ShipSpeed,EntityDirectionZ(ObjAnkerPlayer)*ShipSpeed,0,0,0 )
SetEntityAttribute(ObjAnkerPlayer, #PB_Entity_LinearSleeping , 0.001) ; das automatische deaktivieren der Physik berechnung für das Bewegen runter geschraubt
ElseIf KeyboardPushed(#PB_Key_Pad0) ;- Bremsen entgegen der Schiff Richtung ( Bremsschub )
ShipSpeed = ShipSpeedMax.f
ApplyEntityImpulse(ObjAnkerPlayer,EntityDirectionX(ObjAnkerPlayer)*-ShipSpeed,EntityDirectionY(ObjAnkerPlayer)*-ShipSpeed,EntityDirectionZ(ObjAnkerPlayer)*-ShipSpeed,0,0,0 )
SetEntityAttribute(ObjAnkerPlayer, #PB_Entity_LinearSleeping , 0.001) ; das automatische deaktivieren der Physik berechnung für das Bewegen runter geschraubt
Else
ShipSpeed = 0
EndIf
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Re: The distance covered in space changes when rotating with RotateEntity ()
Here is the link to a source code. The speed display shows the difference visually. Due to the calculation errors, it fidgets a bit. But the faster you move through space. The greater the difference can be seen. The debugger outputs the numbers.
https://www.sourcemagic.ch/SMGC/SMGC.zip
https://www.sourcemagic.ch/SMGC/SMGC.zip
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
- pf shadoko
- Enthusiast
- Posts: 290
- Joined: Thu Jul 09, 2015 9:07 am
Re: The distance covered in space changes when rotating with RotateEntity ()
Hi,
I looked into it, but I don't have enough time.
Also, I don't speak German
the problem doesn't necessarily come from "rotateentity".
Maybe it's a problem of double constraint
two attached objects to which you impose contradictory movements
your code seems to me a bit complicated
I put on the forum a mini simulator
maybe it could help you
viewtopic.php?f=36&t=72732
I looked into it, but I don't have enough time.
Also, I don't speak German
the problem doesn't necessarily come from "rotateentity".
Maybe it's a problem of double constraint
two attached objects to which you impose contradictory movements
your code seems to me a bit complicated
I put on the forum a mini simulator
maybe it could help you
viewtopic.php?f=36&t=72732
Re: The distance covered in space changes when rotating with RotateEntity ()
ooo ... this Plane Simulator works cool..
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak