Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

Best choice for a 3D platform game

You feel lost? You don't understand how to use ShiVa?

Re: Best choice for a 3D platform game

Postby TailsetSonic » 01 Jun 2012, 06:28

I'll try an ultimate solution and after that I'll forget about dynamics ^^', I'll try to add a strong force in the opposed direction of the Y axis of my cube. I try to keep dynamics because there are a lot of things that I better have not to reimplement, that would be stupid =

For the rotation I already got the solution. I get the angle corresponding on the X and Z component of the normal vector of the platform and I do the same for the X and Z component of the Y axis vector. Then I substract the angles from the Y axis with the angle from the normal vector. To finish I make a "rotate" on my character with that values. That perfectly works ^^
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Best choice for a 3D platform game

Postby IS_Brice » 01 Jun 2012, 09:51

Hi guys,

Maybe you can try this solution (with physics engine) :

- addForce to go forward
- get the vertical vector of your character (from head to feet)
- use this vector to set the gravity vector using scene.setDynamicsGravity ( ) (if your character is the only physicalised object, cause if not, you will have a really strange game : ))
IS_Brice
Expert Boarder
Expert Boarder
 
Posts: 97
Location: Toulouse, France

Re: Best choice for a 3D platform game

Postby TailsetSonic » 01 Jun 2012, 12:28

I would like to but I have a lot of other entities in my game ^^
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Best choice for a 3D platform game

Postby IS_Brice » 01 Jun 2012, 12:53

Ok so your idea of adding a big force from head to feet is good too. It should work.

good luck : )
IS_Brice
Expert Boarder
Expert Boarder
 
Posts: 97
Location: Toulouse, France

Re: Best choice for a 3D platform game

Postby TailsetSonic » 10 Jun 2012, 08:36

Hi, it's me again.

I have a question : Is a dynamic object considered as a collider too ?
If I have a dynamic object and if I use getFirstHitColliderEx, will it
detect the dynamic object as a hit collider ?
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Best choice for a 3D platform game

Postby broozar » 10 Jun 2012, 09:32

why don't you try? ;)

short answer: use getFirstHitSensorEx.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3570
Location: Berlin - Germany

Re: Best choice for a 3D platform game

Postby TailsetSonic » 10 Jun 2012, 12:17

I will try ^^

But first I have to solve my jump problem. When I jump I use addForce but it doesn't jump always with the same strengh.
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Best choice for a 3D platform game

Postby giggsy » 10 Jun 2012, 12:45

TailsetSonic wrote:When I jump I use addForce but it doesn't jump always with the same strengh.


Could it be cause the object doesnt always have the same speed?
Adding force isnt equal to setting the velocity ...
User avatar
giggsy
Platinum Boarder
Platinum Boarder
 
Posts: 1103
Location: Austria

Re: Best choice for a 3D platform game

Postby Fraser » 10 Jun 2012, 13:08

giggsy wrote:
TailsetSonic wrote:When I jump I use addForce but it doesn't jump always with the same strengh.


Could it be cause the object doesnt always have the same speed?
Adding force isnt equal to setting the velocity ...


Yes,

to jump set Y-velocity to zero then add linear impulse to Y.

use addForce to Y if you want to reduce gravity while in air while player holds down jump button (most platformers do this)
Fraser Ashworth,
https://www.cortex7.net
User avatar
Fraser
Platinum Boarder
Platinum Boarder
 
Posts: 1086
Location: Europe

Re: Best choice for a 3D platform game

Postby TailsetSonic » 11 Jun 2012, 06:15

It's exactly what I though, depending on the frame the report between different forces may be different. Thank you for your help ^^
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Best choice for a 3D platform game

Postby TailsetSonic » 12 Jun 2012, 10:34

But I have to change the vector velocity from the Globalspace to the LocalSpace of my box that is different from the local space of my dynamic ball. Because when I run on a wall, I want the jump in the direction of the character's Y axis and not of the scene's Y axis.

So what I want to do now is send my vector V from GlobalSpace to the box space, delete the Y component of V, send V from box space to GlobalSpace. But it is very complicated =_= change a vector from a space to an other need to make a lot of matrix operations and there is no tool for that kind of calculation. Is there an other way to make it ? =
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Previous

Return to Getting Started