Flycam
Flycam
hello everyone. i am currently working on a flycam for H2V. I have alot of it done but there is still ALOT of room for improvement. So far, it works great for still cam, but i am still working on making it perfect as a flycam.
here is a video of it so far:
http://www.kleep.com/Video-Games/H2v-Flycam.77565
as you can see, it is a work in progress. the camera moves in intervals of 1 and thats why it looks so jaggedy (if that is even a real word). I will make it smoother in the final version.
another problem you may have noticed is that the camera is always facing th same way!!! this is because i havnt found a way to make it look around (obviously) any suggestions? any help is appreaciated
i have:
-found the address that lets me go into flycam mode.
-found the address containing the X cooridnate of the camera
-found the address containing the Y cooridnate of the camera
-found the address containing the Z cooridnate of the camera
i have not:
-found the addresses containng the yaw, pitch, and roll of the camera (if it even uses yaw, pitch roll)
In the ifnal version, i will make the flycam controllable by both keyboard and 360 controller
if you have any suggestions, feel free to post
here is a video of it so far:
http://www.kleep.com/Video-Games/H2v-Flycam.77565
as you can see, it is a work in progress. the camera moves in intervals of 1 and thats why it looks so jaggedy (if that is even a real word). I will make it smoother in the final version.
another problem you may have noticed is that the camera is always facing th same way!!! this is because i havnt found a way to make it look around (obviously) any suggestions? any help is appreaciated
i have:
-found the address that lets me go into flycam mode.
-found the address containing the X cooridnate of the camera
-found the address containing the Y cooridnate of the camera
-found the address containing the Z cooridnate of the camera
i have not:
-found the addresses containng the yaw, pitch, and roll of the camera (if it even uses yaw, pitch roll)
In the ifnal version, i will make the flycam controllable by both keyboard and 360 controller
if you have any suggestions, feel free to post
- jackson117
- Posts: 565
- Joined: Fri Mar 09, 2007 1:03 pm
- Location: OZ
- jackson117
- Posts: 565
- Joined: Fri Mar 09, 2007 1:03 pm
- Location: OZ
about 70% finished....well the one im going to release is already done...it was done a while back.. but im adding extra features to it that i WONT release... only certain people will have extra features.
normal flycam:
-flycam
-third person
-first person
-stillcam
extended flycam:
-flycam
-third person
-first person
-stillcam
-teleport to current camera coordinates
-increase running/crouching/jumping speed
-decrease running/crouching/jumping speed
-change field of view
-change contrast / brightness
-remove death barriers (just for the heck of it...even though it has nothing to do with flycam )
features i WANT to add but have no clue how to do
-everything yelo trainer for xbox did
-save checkpoint whenever
-load checkpoint whenever
-freeze everything
-well....im too lazy to name them all.....just go to
http://forums.halomods.com/viewtopic.ph ... 00&t=46369
normal flycam:
-flycam
-third person
-first person
-stillcam
extended flycam:
-flycam
-third person
-first person
-stillcam
-teleport to current camera coordinates
-increase running/crouching/jumping speed
-decrease running/crouching/jumping speed
-change field of view
-change contrast / brightness
-remove death barriers (just for the heck of it...even though it has nothing to do with flycam )
features i WANT to add but have no clue how to do
-everything yelo trainer for xbox did
-save checkpoint whenever
-load checkpoint whenever
-freeze everything
-well....im too lazy to name them all.....just go to
http://forums.halomods.com/viewtopic.ph ... 00&t=46369
Sig over width limit.
-
- Posts: 93
- Joined: Fri Aug 03, 2007 7:36 pm
- Contact:
Here's what I was able to dig up a while back...
You can also take a look at some basic camera code I've been using in my directx testbed to get an idea of how the camera works in Yelo since they are very similar...
Camera.h
Camera.cpp
Code: Select all
Halo 2 Vista Camera Addressing
-------------------------------------
0x8BD600 x camera coord
0x8BD604 y camera coord
0x8BD608 z camera coord
0x8BD60C x camera shift (forward/back)
0x8BD610 y camera shift (left/right)
0x8BD614 z camera shift (up/down)
0x8BD618 horizontal look shift (+counterclockwise -clockwise)
0x8BD61C vertical look shift (+up -down)
0x8BD620 camera depth
0x8BD624 field of view
0x8BD628 i forward look vector- cos(h)*cos(v)
0x8BD62C j forward look vector- sin(h)*cos(v)
0x8BD630 k forward look vector- sin(v)
0x8BD634 i up look vector- negative(cos(h)*sin(v))
0x8BD638 j up look vector- negative(sin(h)*sin(v))
0x8BD63C k up look vector- cos(v)
(disables perspective switch override)
move 0x909090 into address 0x459EBB
(enables perspective switch override)
move 0x89710C into address 0x459EBB
(disables writing to camera arrays)
move 0x909090909090 into address 0x482FA3
move 0x9090909090 into address 0x483091
move 0x9090909090 into address 0x4830C9
(enables writing to camera arrays)
move 0xD90410D91C18 into address 0x482FA3
move 0xF30F110C38 into address 0x483091
move 0xF30F110418 into address 0x4830C9
0x8A5288 - Perspective switch address (holds pointer to current perspective function)
0x00000000 = CameraUpdateNone
0x004CCFE4 - CameraUpdateFollowing
0x004CD681 - CameraUpdateFirstPerson
0x004CD9CF - CameraUpdateDead
0x00497EDD - CameraUpdateScripted
Camera.h
Code: Select all
//////////////////////////////////////////////
// Lightweight momentum-based camera system //
//////////////////////////////////////////////
#pragma once
#pragma region Types
typedef enum CameraResistance
{
Linear,
Exponential,
Logarithmic,
Jitter,
Random
};
typedef enum CameraCoordinateSystem
{
LeftHanded,
RightHanded,
Standard
};
#pragma endregion
#pragma region Constraints
static const float MaxLookAngle = 1.57f;
static const float MinLookAngle = -1.57f;
static const float MaxMoveSpeed = 5.0f;
static const float MinMoveSpeed = 0.01f;
static const float MaxLookSpeed = 5.0f;
static const float MinLookSpeed = 0.01f;
static const float MaxMoveAccel = 1.0f;
static const float MinMoveAccel = 0.01f;
static const float MaxLookAccel = 1.0f;
static const float MinLookAccel = 0.01f;
#pragma endregion
class Camera
{
#pragma region Fields
public:
// orientation
Matrix Projection;
Matrix View;
Point3 Position; // position excluding shifts and depth
Vector3 PositionShift; // added to camera origin
Vector3 Velocity;
Vector3 ForwardDirection;
Vector3 VerticalDirection;
Vector3 HorizontalDirection;
Vector3 LookAt;
Vector2 LookAngle;
Vector2 LookShift; // added to look angles
Vector2 LookVelocity;
float Depth; // scaled with negative forward look direction, and added to origin
float FieldOfView; //zoom
float SpeedScale;
float LookSpeedScale;
float MoveAcceleration;
float LookAcceleration;
float ZoomVelocity;
float ViewDistance;
#pragma endregion
#pragma region Methods
public:
Camera();
~Camera(void);
// immediates
void MoveTo(Vector3 position);
void LookTo(Vector2 direction);
// acceleration
void ApplyForce(Vector3 force);
void ApplyLookForce(Vector2 force);
void Update();
void Release();
void GetStats(wchar_t* strBuffer);
void GetSpeed();
void Zoom(float factor);
#pragma endregion
};
Code: Select all
#include "DXUT.h"
#include "Camera.h"
Camera::Camera()
{
// initialize default settings
FieldOfView = DegToRad(70);
SpeedScale = 0.15f;
LookSpeedScale = 0.15f;
MoveAcceleration = 0.1f; // lower the value, the slower the acceleration (1 = instantaneous movement)
LookAcceleration = 0.2f;
ZoomVelocity = 0;
ViewDistance = 1000;
}
Camera::~Camera(void)
{
}
void Camera::MoveTo(Vector3 position)
{
Position = position;
}
void Camera::ApplyForce(Vector3 force)
{
Velocity += force * SpeedScale;
}
void Camera::LookTo(Vector2 direction)
{
LookAngle = direction;
}
void Camera::ApplyLookForce(Vector2 force)
{
LookVelocity += force * LookSpeedScale;
}
void Camera::Update()
{
// update velocities based on resistance
Velocity -= Velocity * MoveAcceleration;
LookVelocity -= LookVelocity * LookAcceleration;
ZoomVelocity -= ZoomVelocity * 0.2f;
// update position and look angles based on velocities
Position += Velocity;
LookAngle += LookVelocity;
FieldOfView *= 1.0f + ZoomVelocity;
// keep fov in check
if (FieldOfView < DegToRad(0.05))
FieldOfView = DegToRad(0.05);
if (FieldOfView > DegToRad(120))
FieldOfView = DegToRad(120);
// do a little math...
float sh = sin(this->LookAngle.x);
float sv = sin(this->LookAngle.y);
float ch = cos(this->LookAngle.x);
float cv = cos(this->LookAngle.y);
// calculate new look directions
ForwardDirection = Vector3(ch*cv, sv, sh*cv);
VerticalDirection = Vector3(-ch*sv, cv, -sh*sv);
HorizontalDirection = Vector3(cos(LookAngle.x + 1.57f), 0, sin(LookAngle.x + 1.57f)); // left
LookAt = Position + ForwardDirection; // destination
// keep look angle components in check
LookAngle.x = ((LookAngle.x / (PI * 2)) - (int)(LookAngle.x / (PI * 2))) * PI * 2;
if (LookAngle.y > MaxLookAngle)
LookAngle.y = MaxLookAngle;
if (LookAngle.y < MinLookAngle)
LookAngle.y = MinLookAngle;
// calculate projection transform
Matrix::PerspectiveFovLH(&Projection, FieldOfView,(float)DXUTGetWindowClientRect().right/(float)DXUTGetWindowClientRect().bottom, 0.1f, ViewDistance);
//Projection = Matrix::BuildProjection(1.0f, 1000.0f, DegToRad(90), DegToRad(90));
// calculate view transform
Matrix::LookAtLH(&View, &Position, &LookAt, &VerticalDirection);
}
void Camera::Zoom(float factor)
{
FieldOfView *= factor;
// keep fov in check
if (FieldOfView < 0.001f)
FieldOfView = 0.001f;
if (FieldOfView > 2.0f)
FieldOfView = 2.0f;
}
void Camera::Release()
{
}
void Camera::GetStats(wchar_t* strBuffer)
{
swprintf(strBuffer, L"======Camera Statistics======\n\
Position: < %.3f, %.3f, %.3f >\n\
Forward Unit: < %.3f, %.3f, %.3f >\n\
Up Unit: < %.3f, %.3f, %.3f >\n\
Look Angle: < %.3f, %.3f >\n\
FOV: %.3f\n\
Speed: %.3f\
", Position.x, Position.y, Position.z, ForwardDirection.x, ForwardDirection.y, ForwardDirection.z, VerticalDirection.x, VerticalDirection.y, VerticalDirection.z, LookAngle.x, LookAngle.y, FieldOfView, Velocity.Length());
}
- jackson117
- Posts: 565
- Joined: Fri Mar 09, 2007 1:03 pm
- Location: OZ
-
- Posts: 182
- Joined: Fri Oct 26, 2007 5:04 am
Jackson the answer to that question is: When he feels like it. Didnt you ever learn some people find it very irritating for you to ask for a release date. Here this guy puts a bunch of work into his flycam and your going to just run off with it and forget who even made it. If your going to use it and want it. Suport it dont be nit picky and just want a release. BE PATIENT like the rest of the community.
P.s. there was no yelling or flaming in that post!
P.s. there was no yelling or flaming in that post!
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
- jackson117
- Posts: 565
- Joined: Fri Mar 09, 2007 1:03 pm
- Location: OZ