+ Reply to Thread
Results 1 to 8 of 8

Thread: Speedometer XYZ - Local or World?

  1. #1
    Wire Sofaking mjmr89's Avatar
    Join Date
    Mar 2008
    Posts
    555

    Default Speedometer XYZ - Local or World?

    Just wondering if the option for XYZ values on the speedo are local or world values. It seems to me they are world - if so, is there any way to get local xyz speed values? I'm hoping to fix some drift using a local speedo or something that does the same kind of thing (I've tried VTs to stop drifting, but they always spiral to a stop which pisses me off).

    Thanks!

  2. #2
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: Speedometer XYZ - Local or World?

    They are probably world values. To get local values from the world values you just have to project the velocity vectors on the up, right and forward vectors, in EGate 2 that would be:

    Vel = vec(WorldX,WorldY,WorldZ)
    LocalX = -Vel:dot(entity():forward())
    LocalY = Vel:dot(entity():right())
    LocalZ = Vel:dot(entity():up())

    I have no idea why X is to the back and Y to the right, but that's how I had to calculate it to make it work in my flying system.

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  3. #3
    Wire Sofaking mjmr89's Avatar
    Join Date
    Mar 2008
    Posts
    555

    Default Re: Speedometer XYZ - Local or World?

    I'll give that a try - what is it relative to? Like is the top of the chip pos X or neg x or what?

    Well I just gave that a try - it seems to work sometimes, but not others. Seems if it has a large speed in both x and y directions, it spins and sort of spirals toa stop like the vector thrusters.

    EDIT: Turns out it doesn't like it when I push it in a direction and it isn't lined up with the world xyz coords.
    Last edited by mjmr89; 12-10-2008 at 11:17 AM.

  4. #4
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: Speedometer XYZ - Local or World?

    It looks like the top of the chip is negative X.

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  5. #5
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: Speedometer XYZ - Local or World?

    Quote Originally Posted by Fizyk View Post
    They are probably world values. To get local values from the world values you just have to project the velocity vectors on the up, right and forward vectors, in EGate 2 that would be:

    Vel = vec(WorldX,WorldY,WorldZ)
    LocalX = -Vel:dot(entity():forward())
    LocalY = Vel:dot(entity():right())
    LocalZ = Vel:dot(entity():up())

    I have no idea why X is to the back and Y to the right, but that's how I had to calculate it to make it work in my flying system.
    You can actually just do entity():toLocal(vec(WorldX,WorldY,WorldZ)) instead (or toWorld())

  6. #6
    Wire Sofaking mjmr89's Avatar
    Join Date
    Mar 2008
    Posts
    555

    Default Re: Speedometer XYZ - Local or World?

    Eh... I was just perusing the egate2 documentation and found this -
    E:velL() V -gets the local velocity of the entity

    So something like:
    entity():velL():x() ?

  7. #7
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: Speedometer XYZ - Local or World?

    Quote Originally Posted by mjmr89 View Post
    Eh... I was just perusing the egate2 documentation and found this -
    E:velL() V -gets the local velocity of the entity

    So something like:
    entity():velL():x() ?
    Yep

  8. #8
    Wire Sofaking mjmr89's Avatar
    Join Date
    Mar 2008
    Posts
    555

    Default Re: Speedometer XYZ - Local or World?

    Yep, it does work pretty well... Except sometimes I STILL get some yaw movement - why? I'm using smartsnap and stuff so they should be 100% aligned with each other...

+ Reply to Thread

Similar Threads

  1. Seting a local variable with derma ?help?
    By Jarviar in forum Off-Topic
    Replies: 1
    Last Post: 10-24-2008, 05:44 AM
  2. local string = [[
    By Jarviar in forum Off-Topic
    Replies: 1
    Last Post: 10-09-2008, 04:50 PM
  3. Expression: Convert local or world (x,y,z) to (bearing,elevation)
    By Paper Clip in forum Finished contraptions
    Replies: 19
    Last Post: 10-09-2008, 06:44 AM
  4. Nocollide-World
    By andy1976uk in forum Ideas & Suggestions
    Replies: 2
    Last Post: 07-09-2008, 11:32 PM
  5. Local Hoverdrive cords♠
    By llivavin in forum Ideas & Suggestions
    Replies: 2
    Last Post: 08-23-2007, 02:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots