Author Topic: Memory Adress / offest for pitch, yaw, roll  (Read 3624 times)

Jeff Anderson

  • Boss
  • ****
  • Posts: 121
Memory Adress / offest for pitch, yaw, roll
« on: September 19, 2015, 03:18:09 PM »
Codewalker,

(And anyone else who may know)

I have succesfully implemented moving NPC using WASD, its very cool, you can click on a npc and move around with keyboard, once i add animations I think it willk look just like moving the player character, will post soon. I did by setting the memory at specific address offests from the pointer to the targeted character.

 I am having trouble locating pitch, yaw, and roll in the mermory block associated to the character, so my poor NPC cant turn or look up / down :(

I anyone has pointer I would love to hear them
, thanks

Codewalker

  • Hero of the City
  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 2,740
  • Moar Dots!
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #1 on: September 20, 2015, 05:00:09 AM »
You won't find those because there is no such thing. Orientation is not kept as PYR in memory, it's only converted (really estimated) as PYR for demorecords and a few other things. COH uses a 3x4 matrix to represent both orientation and position.

Right before the position are 9 floating point numbers that are the rest of the matrix (translation is in row 4). Constructing a PYR equivalent to a simple rotation-only matrix requires some math. If you want to be consistent with the way COH handles it for demos, you need to actually use a YPR order of rotations.

Noyjitat

  • Elite Boss
  • *****
  • Posts: 717
  • Guess who cares?
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #2 on: September 20, 2015, 05:00:27 AM »
Wouldn't that be associated with camera? Because we were not animated to look up or down the only way a player moved in such fashion was when using an attack while being below or above something usually while flying or on a platform above the target.

BTW Jeff if you can get this to work with multiple targets at once like in your table top program that would be sweet. I really want a way to control multiple npcs walking or running... ofcourse currently icon lack the walk power that paragon chat has.

Jeff Anderson

  • Boss
  • ****
  • Posts: 121
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #3 on: September 20, 2015, 06:36:36 AM »
I did notice a bunch of variables that consistently changed when I updated orientation from the editpos command but was really challenged to make heads or tails of it.

when editpos is used to turn a character by updating YAW what memory vars get afftected, is there a set algorithm you use / create to get the facing right?

also what is meant by a Ypr order of rotation?

Jeff Anderson

  • Boss
  • ****
  • Posts: 121
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #4 on: September 20, 2015, 06:40:42 AM »
Wouldn't that be associated with camera? Because we were not animated to look up or down the only way a player moved in such fashion was when using an attack while being below or above something usually while flying or on a platform above the target.

BTW Jeff if you can get this to work with multiple targets at once like in your table top program that would be sweet. I really want a way to control multiple npcs walking or running... ofcourse currently icon lack the walk power that paragon chat has.

i *think* i have a way to animate and move crowds, codewalker pointed me to where all entities live in memory, so updating all positions at the sam time shoudnt be to bad, getting all the animations going at the same may also be doable, if i can generate a keybind that lets me target and move multiples.

Codewalker

  • Hero of the City
  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 2,740
  • Moar Dots!
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #5 on: September 21, 2015, 02:15:16 AM »
when editpos is used to turn a character by updating YAW what memory vars get afftected, is there a set algorithm you use / create to get the facing right?

All 9 elements of the 3x3 part of the matrix that represents orientation are potentially affected by a change in yaw. The middle 3 (second column) will probably remain constant. There is an algorithm, but if you understand the math behind it, you're a lot less likely to run into issues that you can't solve. I'd highly suggest looking up transformation matricies in a 3D graphics concept. Use of them is quite common in game programming, so there is a ton of material on the subject that can help.

also what is meant by a Ypr order of rotation?

A matrix is an unambiguous way to represent orientation. Disregarding floating point error, there is only one matrix that corresponds to a particular orientation and vice versa.

Euler angles on the other hand, are ambiguous because not only do they "wrap around" when outside the range of 0-2*pi (or 0-360 degrees), there's also the question of what order to apply the rotations in. Do you pitch the object up 30 degrees, then yaw it (along the new axis) 50, or do you yaw 50 first and then pitch up? Those two operations do not result in the same final orientation.

When processing PYR from something like a demorecord and composing it into a matrix, even though they are in the file in Pitch-Yaw-Roll order, COH applies Yaw first, then Pitch, then Roll.

Jeff Anderson

  • Boss
  • ****
  • Posts: 121
Re: Memory Adress / offest for pitch, yaw, roll
« Reply #6 on: September 21, 2015, 05:42:13 AM »
Awesome,

I will do the research on transformation matricies, sounds like an uber cool topic. I have a few hours a day to look into this over the next week so hopefully I can get this in relatively soon.

Attached is a quick video i put together moving external NPCs around,  (minus facing of course)

https://www.youtube.com/watch?v=VQ7szu7B6GM&feature=youtu.be