Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


ThePointingMan

Member Since 09 Nov 2010
Offline Last Active Jun 01 2015 10:25 AM

Posts I've Made

In Topic: Communication between objects and systems in Game engines.

21 May 2015 - 01:50 AM

I am liking the idea of the higher level code with knowledge of both ideas, and then keeping the actual character in the dark about everything, seems to be what most of you are suggesting too. So if I'm getting this right, the player itself will basically just be a block of data, it has some render information, its transform, and maybe some collider information, but it doesn't really do anything. Then I have some higher level systems like one for keeping objects grounded that has information about the physics world. the gamestate passes everything that needs to be effected by this system to it, all the players/npc's etc. Another example could be like... a player controller that tells the player to move based on input or something. Nothing is actually done by the character, only by things who's purpose is telling the player to do things. 

 

 

write games, not engines

Yeah haha, this is something I'm trying to push on myself, it's so easy to get lost in the idea of engine construction and completely forget about what you wanted to use the engine to make. I'm just making small scale 2D stuff too, so I really don't need to go overboard on engine construction.


In Topic: Smoothing out the ray tracing of a surface on a curve

16 October 2013 - 05:14 PM

For the hover mechanic, I shoot a raycast straight down from the center of the ship, if the distance from the start of the ray to where the ray hits is shorter then a specific amount it moves it back up to the minimum distance. As for the physics engine, It seems as though Unity uses the PhysX engine. Unfortunately I can't give you specific pieces of code right now as I am not at my house, but when I return there I will put up some more info on how I am doing everything. I think this first suggestion AllEightUp gave will probably do the trick though! Thanks very much for your input. I'm also thinking of doing something like what rumblesushi suggested, I'm thinking having a raycast at the middle, nose, and back, all checking would probably be best.


In Topic: Depth Transparecy issues.

19 June 2013 - 03:35 AM

So I literally need to just make sure that when something is rendered it is rendered before everything that it needs to cover?


In Topic: Rotation in 3D

15 June 2013 - 02:30 PM

Inverting it seems to have fixed everything! Thanks so much.


In Topic: Rotation in 3D

12 June 2013 - 07:52 PM

In the long run I did end up going for the method you had suggested, but things aren't quite working correctly, I can't pinpoint what the problem is though. It appears as though the camera is rotating around the origin point, but I am fairly certain it should be translating and rotating locally with this code. I'm also not sure whether I set up my matrix properly, I have never manually set the values in a matrix before and I couldn't find the order in which it needs to be filled on msdn.

 

Edit:

{

 I have this feeling it is related to this line here node->Position->Position += (node->Position->Forward * node->Velocity->VelocityPos.z); My guess is that this is permenantly multiplying forward by the distance, while it only needs to be multiplied for this assignment and then go back to not being multiplied.
}

 

Here's what my camera matrix looks like.

//Rotate Dem vectors
				D3DXMATRIX yaw; 
				D3DXMatrixIdentity(&yaw);
				//Programming when you are tired is a bad idea, very important
				D3DXMatrixRotationAxis(&yaw,&ActiveCamera->Up,node->Position->Angle.y*(M_PI/180));

				D3DXVec3TransformCoord(&ActiveCamera->Forward,&ActiveCamera->Forward,&yaw);
				D3DXVec3TransformCoord(&ActiveCamera->Right,&ActiveCamera->Right,&yaw);
				// set the view transform

				// set the projection transform
				node->Camera->mCamera(0,0) = ActiveCamera->Right.x;
				node->Camera->mCamera(1,0) = ActiveCamera->Up.x;
				node->Camera->mCamera(2,0) = ActiveCamera->Forward.x;
				node->Camera->mCamera(3,0) = ActiveCamera->Position.x;
				
				node->Camera->mCamera(0,1) = ActiveCamera->Right.y;
				node->Camera->mCamera(1,1) = ActiveCamera->Up.y;
				node->Camera->mCamera(2,1) = ActiveCamera->Forward.y;
				node->Camera->mCamera(3,1) = ActiveCamera->Position.y;

				node->Camera->mCamera(0,2) = ActiveCamera->Right.z;
				node->Camera->mCamera(1,2) = ActiveCamera->Up.z;
				node->Camera->mCamera(2,2) = ActiveCamera->Forward.z;
				node->Camera->mCamera(3,2) = ActiveCamera->Position.z;




				D3DXMatrixPerspectiveFovLH(&node->Camera->mLense,
										   D3DXToRadian(45),
										   (FLOAT)600 / (FLOAT)600,
										   1.0f,    // the near view-plane
										   1000000.0f);    // the far view-plane
	
			

//This is what the position component looks like

#pragma once
#include "Component.h"
#include "Directx.h"
class PositionComponent : public Component
{
public:
	PositionComponent(unsigned int ID) : 
	  Component(ID)
		  ,Position(0,0,0)
		  ,Forward(0,0,1)
		  ,Up(0,-1,0)
		  ,Right(1,0,0)
		  ,Angle(0,0,0)
	{
	}
	  //I realize now that it would have been better to have made a forward vector, up vector and right vector, thus I will be modifying how everything is moved later, but again I'm rushsian here!
	  //LOL JK QUATERNIANS ALL THE WAY! I don't want none of this Gimball lock crap! TIME TO REWRITE EVERYTHING!
	  ///I dont think I am ready for quaternians :/
	D3DXVECTOR3 Angle;
	D3DXVECTOR3 Position;
	D3DXVECTOR3 Forward;
	D3DXVECTOR3 Up;
	D3DXVECTOR3 Right;

};

This is where every object gets moved

for(auto index = targets.begin(); index != targets.end(); index++)
{
		auto node = static_cast<MoveNode*>(*index);

		node->Position->Position += (node->Position->Forward * node->Velocity->VelocityPos.z);

And here is where the world and view matrix come in

{
		auto node= static_cast<RenderQuadNode*>(*index);
		//Deal with the matrices
		D3DXMATRIX mTranslate;
		D3DXMATRIX mRotateX;
		D3DXMATRIX mRotatey;
		D3DXMATRIX mRotatez;
		D3DXMATRIX mScale; //MAYBEH LAAAAATA
		D3DXMATRIX mWorld;
		//Set All Matrices to a neutral state
		D3DXMatrixIdentity(& mWorld);
		D3DXMatrixIdentity(&mTranslate);
		D3DXMatrixIdentity(& mRotateX);
		D3DXMatrixIdentity(& mRotatey);
		D3DXMatrixIdentity(& mRotatez);
		D3DXMatrixIdentity(& mScale);
		//MoveEverythaaaang
		D3DXMatrixTranslation(&mTranslate,node->Position->Position.x,node->Position->Position.y,node->Position->Position.z);
		//D3DXMatrixRotationX(&mRotateX,node->Position->Angle.x*(M_PI/180));
		
		//Update the world
		mWorld = mRotateX * mRotatey * mRotatez * mTranslate;
		// select which vertex format we are using
		d3d->d3ddev->SetFVF(d3d->FVF);


		//set up camera
		d3d->d3ddev->SetTransform(D3DTS_VIEW, &node->Camera->mCamera);
		
		d3d->d3ddev->SetTransform(D3DTS_PROJECTION, &node->Camera->mLense);


PARTNERS