• Create Account

# KurtO

Member Since 05 Dec 2011
Offline Last Active Feb 15 2013 06:31 AM

### gravity problem

15 February 2013 - 02:44 AM

here my problem.

With "medium" downForce my collisionresponse/sliding is very nice.

with "high" forceDown (good when falling outside the level) the sliding is jerky.

medium force = problem when falling outside, the player falls to slow.

high force = problem for player to go uphills. if i set the gravity that is good for falling the player have not enough power to go uphills wihout gravity pushing player down.

I would like a gravity that is good enought from basic with freefall and also so the player can climb hills?

Do i have to calculate two different gravity, one for on plane and one outside plane?

Also, i rotate my whole gamelevel so when rotation begins i need the player to slide down the floor at a good speed.

A good speed now on ground is to slow. that makes two gravities now work.

I hope you understand my problem.

When using strong downForce, my collision sliding becomes jerky and player can´t walk uphills (even moderate hills).

I use v- = n * dot(n,v) but i don´t feel it makes any change to my gravity / shouldent this formula reduce gravity once on contact with a plane?

### Blender to DirectX Export problem

13 February 2013 - 02:52 AM

I know blender is using the right-handed and DirectX is using Left handed coordinate system.

Of course this is creating some problem with my export.

But my problem isn´t logical.

I have made the simplest model in Blender and then export vertex-list x,y,z and normal x,y,z and u,v for texture mappings.

If i import my model with x = x, y = y, z = z from blender to DirectX in both vertex and normals my model is drawned like this:

It is 90 degrees tilted (this is understandable and logic), BUT also the model is "mirrored" in X-axis.

I can fix the Title by changing x with z when importing. but my normals is always wrong then and i cant fix it.

my code looks like this.

model = my directX model that has vertex Vector3 and normaol Vector3 and u,v float for mapping.

import = values from my export script from blender.

//When i just import the model i use this:

model.vertex.x = import.vertex.x;

model.vertex.y = import.vertex.y;

model.vertex.z = import.vertex.z;

model.texture.u = 1-import.texture.u;

model.texture.v = import.texture.v;

model.normal.x = import.normal.x;

model.normal.y = import.normal.y;

model.normal.z = import.normal.z;

this is just 1->1 import and gives me titled result with mirrored x-axis.

I have tried this, but it wont work, the model is right but my normals and uv-mapping is wrong...

model.vertex.x = -import.vertex.x;

model.vertex.y = import.vertex.z;

model.vertex.z = -import.vertex.y;

model.texture.u = 1-import.texture.u;

model.texture.v = import.texture.v;

//No mather what i set my normals to it is still wrong normals...

model.normal.x = -import.normal.x;

model.normal.y = import.normal.z;

model.normal.z = i-mport.normal.y;

How should my import routine look like for my vertex and normals plus uv?

### Blender export problem

18 November 2012 - 02:44 AM

Okay.

DirectX and Blender don´t share the same coordinate system.
I used to fix this by importing my models like this.
Also the UV system isnt the same. but i used to fix my models like this:

[source lang="cpp"]for(int i=0;i<m_vertexCount;i++) { model_vertices[i].Color = color; model_vertices[i].Normal.x = Level1Vertices[i].Normal.x; model_vertices[i].Normal.y = Level1Vertices[i].Normal.y; model_vertices[i].Normal.z = Level1Vertices[i].Normal.z; model_vertices[i].U = Level1Vertices[i].U; model_vertices[i].V = Level1Vertices[i].V;//THIS IS WHERE I DO MY FIX model_vertices[i].X = position.x + Level1Vertices[i].X; model_vertices[i].Y = position.y + Level1Vertices[i].Z; model_vertices[i].Z = position.z + -Level1Vertices[i].Y; }[/source]

Suddenly now my models are mirrored left to right. *sight*...
It feels like the export from blender is Random, It gets right 1 time of 10. Pretty frustrating not to be able to rely on the export.
This trouble takes to much time from my development.

Any ideas?

### HLSL rookie question

14 November 2012 - 04:30 AM

I am not very good at HLSL yet.

I have a constantbuffer that i am trying to sent an integer through.
i am 99% sure the int is going in to my HLSL pipeline but i cant get hold of the value.

this is my HLSL file:

How can i include my variable int test?

[source lang="cpp"]cbuffer ConstantBuffer{ float4x4 final; // (4+4) * 16 float4 lightvec; // the light's vector (1) * 16 float4 lightcol; // the light's color (1) * 16 float4 ambientcol; // the ambient light's color (1) * 16 float4x4 worldMatrix; // (4+4) * 16 float4x4 viewMatrix; // (4+4) * 16 float4x4 projMatrix; // (4+4) * 16 int test;}Texture2D Texture;SamplerState ss;//DO I NEED TO DECLARATE TEST HERE?struct VOut{ float4 color : COLOR; float2 texcoord : TEXCOORD; // texture coordinates float4 position : SV_POSITION;};//DO I NEED TO PASS TEST HERE ALSO?VOut VShader(float4 position : POSITION, float4 normal : NORMAL, float2 texcoord : TEXCOORD, float4 color: COLOR){ VOut output; float4x4 worldViewMatrix = mul(worldMatrix, viewMatrix); float3 positionVS = position + float3(worldViewMatrix._41, worldViewMatrix._42, worldViewMatrix._43); output.position = mul(float4(positionVS, 1.0f), projMatrix); output.position = mul(final, position); // set the ambient light output.color = ambientcol; output.color.rgb = color.rgb; // calculate the diffuse light and add it to the ambient light float4 norm = normalize(normal); float diffusebrightness = saturate(dot(norm, lightvec)); output.color += lightcol * diffusebrightness; //be sure to take alpha last as other formulas might destroy this. output.color.a = color.a; output.texcoord = texcoord; // set the texture coordinates, unmodified return output;}float4 PShader(float4 color : COLOR, float2 texcoord : TEXCOORD) : SV_TARGET{ float4 resultcolor = color * Texture.Sample(ss, texcoord); //THIS DOES NOT WORK: HERE IS MY PROBLEM. //if (test==1) resultcolor.a = 0.0f; //if(resultcolor.r < 0.2f && resultcolor.g < 0.2f && resultcolor.b < 0.2f) //resultcolor.a = 0.0f; return resultcolor; }[/source]

### Jump problem identify floor

06 November 2012 - 06:42 AM

Hi. I have a problem in my fps game engine. I cant seem to figure och which triangles in my level that is the floor.
Basically now the player can jump again as soon as i touch any wall/floor/roof. But i want the player only to jump again if location is on the floor.

My collision detection is calc length to triangle and push the player out the amount it is to close from sphere radius.

Any ideas?

PARTNERS