Jump to content

  • Log In with Google      Sign In   
  • Create Account

NumberXaero

Member Since 29 Apr 2002
Online Last Active Today, 11:24 PM

#5187875 [PhysX] Allow players to slide down slopes / Controller contact callbacks

Posted by NumberXaero on 18 October 2014 - 01:48 PM

The character controller description has a reportCallback member that can be set to an implementation of PxUserControllerHitReport. PxUserControllerHitReport has virtual functions

 

virtual void onShapeHit(const PxControllerShapeHit& hit);        
virtual void onControllerHit(const PxControllersHit& hit);
virtual void onObstacleHit(const PxControllerObstacleHit& hit);

 

the PxController*Hit objects all derive from PxControllerHit which has members worldPos, worldNormal, dir, length, etc. Using these members and few dot products and vector math you should be able to slide the character downward according to your own gravity.

 

You didnt mention physx version, this is assuming some version >= 3.0 or so.




#5182821 Legal use of fonts

Posted by NumberXaero on 25 September 2014 - 01:34 AM

Theres this https://www.google.com/fonts which says this in the about
 

About Google Fonts

A web with web fonts is more beautiful, readable, accessible and open.

Google Fonts makes it quick and easy for everyone to use web fonts, including professional designers and developers. We believe that everyone should be able to bring quality typography to their web pages and applications.

Our goal is to create a directory of web fonts for the world to use. Our API service makes it easy to add Google Fonts to a website in seconds. The service runs on Google's servers which are fast, reliable and tested. Google provides this service free of charge.
Open Source Fonts

All of the fonts are Open Source. This means that you are free to share your favorites with friends and colleagues. You can even customize them for your own use, or collaborate with the original designer to improve them. And you can use them in every way you want, privately or commercially — in print, on your computer, or in your websites.

We are working with designers around the world to publish quality typeface designs that are made for the web. If you are a type designer and would like to discuss this, please get in touch.

Many of Google's own web pages are already using Google Fonts, such as Google's About page and Google's World Wonders Project which use Open Sans.
— The Google Fonts Team

 

 

Im not a lawyer and although ive never used them commercially, there doesnt seem to be any restrictions from reading the part I made bold, they can all be downloaded in zip.




#5180392 What is the definition of the position of a bone?

Posted by NumberXaero on 15 September 2014 - 01:20 AM

Generally the bones translation (the translation you store, lerp) is local/relative to the bones parent bone, if there is no parent bone its local = world. You would transform a bones local transform by its parents world transform to create its world transform, and then use the result for skinning.

As for blenders terminology Im not sure, local = tail? maybe? I find the term bone confusing, it implies two end points, when modeling packages tend to view them as transform nodes with an optional parent node. Nothing says you cant have a single bone-node-transform, attach a model to it and animate it.




#5178451 OpenGL texture array difficulties

Posted by NumberXaero on 06 September 2014 - 12:40 AM

glTexParameteri(GL_TEXTURE_2D........ ARRAY?




#5177144 COLLADA vs FBX... Are They Worthwhile for Generic Model Formats?

Posted by NumberXaero on 30 August 2014 - 07:43 PM

That about sums it up. Pretty much the same experience i had with COLLADA. I bounced around forums trying to figure out why this or that would cause a crash or produce a different result between maya and 3ds max. Waiting for exporters to be updated by someone else killed it for me.

I had kept an eye on FBX but with the versions and heavy weight details and extras, I didnt have it in me to get into it after COLLADA. Eventually I figured these problems would never completely go away, so I wrote my own, a sort of tag based binary COLLADA.

I figured the time being wasted fighting and understanding the output from these model packages and file formats would be better spent on something concrete, like an exporter for my own format.

In the end the time was well spent, I have an exporter, I have a file format, I can add sections to it to support future (game specific) ideas, I control how the data is ordered and read in, if it breaks it means the modeling package changed (rare), I can ignore what I dont need during the export (smaller files).

I will say though, If I hadnt gotten pretty deep into COLLADA in the first place, getting the animation data right probably would have been more confusing.




#5176283 OpenGL - glReadPixels returns incorrect values

Posted by NumberXaero on 26 August 2014 - 02:35 PM

Not sure what gl version you are targeting, try

if(status == GL_FRAMEBUFFER_COMPLETE)
{
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);

	unsigned char *pixels = new unsigned char[w *h *3];
	for(unsigned int i=0;i<(w *h *3);i++)
	pixels[i] = 255;
	glDrawPixels(w,h,GL_RGB,GL_UNSIGNED_BYTE,&pixels[0]);

        glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
        glReadBuffer(GL_COLOR_ATTACHMENT0);
	glReadPixels(0,0,w,h,GL_RGB,GL_UNSIGNED_BYTE,&pixels[0]);
	for(unsigned int i=0; i<(w *h *3); i+=3)
	{
		unsigned int r = pixels[i];
		unsigned int g = pixels[i + 1];
		unsigned int b = pixels[i + 2];
		std::cout<<i<<": "<<r<<","<<g<<","<<b<<std::endl;
	}
	delete[] pixels;

        glReadBuffer(GL_BACK);

	int err = glGetError(); // No error reported
}



#5173038 QT vs. wxWidgets for OpenGL

Posted by NumberXaero on 12 August 2014 - 01:49 AM

Widgets does have its own delegates called events, you can call Connect() (Bind in newer versions) to connect a function to an object id, the object is used the function is called. The function doesnt have to belong to a unique class, it can be a previously derived class. It also has an event table that is similar to how MFC works.

 

class ClassButtonLivesIn : public ...

{

   wxButton* someButtonNotDerived;

}

 

// in ctor ClassButtonLivesIn

someButtonNotDerived->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ClassButtonLivesIn::OnButtonClick ), NULL, this);

 

and then call Disconnect() later




#5172993 How to calculate camera roll...

Posted by NumberXaero on 11 August 2014 - 08:34 PM

Build qpitch, qyaw, combine for qPitchYaw which now holds the new camera forward after pitch and yawing, build qroll from this new forward direction, combine qroll with qpitchYaw for qPitchYawRoll the new orientation.




#5168555 Post process order?

Posted by NumberXaero on 22 July 2014 - 08:35 PM

Wondering what people think, or what you do yourself and why, stick any I may have missed in.

 

Screen space reflections - havent done them, not sure where, close to start?...
Eye Adaptation - builds info probably done early?
Lens flare - get it in before bloom?

Bloom - before dof ??
DOF - you want the bloom 'under' it?

FXAA - you want to AA toward then end right?

Color Correction - want final color, before correcting...

Tone Mapping - fit for ldr

Gamma Correction - correct for screen output

Vignette - because its just black on top of everything else...




#5167043 PhysX - Stick controllers to kinematic actors

Posted by NumberXaero on 15 July 2014 - 01:36 PM

Yeah the move flags wont be able to solve everything, the horizontal stuff is trickier. The horizontal movement behavior would probably be best handled in the PxUserControllerHitReport which would return the world normal of the wall you hit and at what point, then you could handle custom sliding by reducing the xz velocity based on the angle you hit at, where the move flags would be used to kill vertical movement from hitting above or below and provide a hint about side hits.

 

My velocity use was more limited to vertical movement, for falling and jumping. When it came to horizontal movement I simply passed a move amount because the horizontal movement was tied to the motion extracted from the walk/run animations, so I knew how much to move based on the animation otherwise he would look like he was sliding if I moved more (or less) then what looked right according to the animation.




#5166930 PhysX - Stick controllers to kinematic actors

Posted by NumberXaero on 15 July 2014 - 01:45 AM

Well keep in mind these are move flags, returned as the result of a move call, I believe the sides flag is means that you hit something in the direction of the move around the middle part of the controller shape, meaning you are blocked from moving sideways by something which Im guessing cant be auto stepped, PxControllerDesc::stepOffset.

The controllers really just to keep you from go through the world (although you still do sometimes :-( ).

If your talking about getting side hit by projectiles in a gameplay fashion, you might want to catch hits in the callbacks and check the direction between the controller and the actor/shape hitting you to know exactly which side you were hit from.

 

For slopes, grab the world info in a PxUserControllerHitReport callback, check the normal of the object youre standing on and factor the slope angle and gravity force into your next move adjustment to slide move down the slope if the angles suitable.

 

They have changed things in PhysX so often I cant remember if there was an auto slide at one time or not depending on the slope angle, might still be Im not sure.




#5166799 PhysX - Stick controllers to kinematic actors

Posted by NumberXaero on 14 July 2014 - 02:22 PM

The px controller only uses a move interface, the way I did it is each frame calculate a move offset (displacement), pass it to the controller, and get the corrected position back after the update.

I dont pull velocity out of the physx controller, but I do use velocity in a way similar to how your doing it. I use my own force/acceleration/velocity/position to create a displacement amount, I pass my position change to the controller, and the controller move call returns collision flags. If the flags indicate a collision below, you simply zero out the y velocity, and similar for collisions on the side.




#5166620 PhysX - Stick controllers to kinematic actors

Posted by NumberXaero on 13 July 2014 - 03:22 PM

I also dont have nvidia in this comp, but I just did a test with some kinematic actors (platforms much like yours) and a controller jumping onto it, you need the ride and slide flags.

 

    physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxShape &shape,const physx::PxActor &actor)
    {
        return physx::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT | physx::PxControllerBehaviorFlag::eCCT_SLIDE;
    }

 

without it, my platforms slide away from under the controller.

 

Edit: you probably want to check that the actor is kinematic first before returning those flags, riding dynamics might not work well.




#5166486 PhysX - Stick controllers to kinematic actors

Posted by NumberXaero on 12 July 2014 - 05:28 PM

The bridges demo shows how it works.

This is explained in the sample code, SampleBridgesCCT.cpp, by implementing the PxControllerBehaviorCallback, and allowing riding between the controller and a touched shape (which you would have to id as being able to ride).




#5165725 Public domain fonts for redistribution?

Posted by NumberXaero on 08 July 2014 - 09:54 PM

Might help

 

https://www.google.com/fonts

 

about

 

 

A web with web fonts is more beautiful, readable, accessible and open.

Google Fonts makes it quick and easy for everyone to use web fonts, including professional designers and developers. We believe that everyone should be able to bring quality typography to their web pages and applications.

Our goal is to create a directory of web fonts for the world to use. Our API service makes it easy to add Google Fonts to a website in seconds. The service runs on Google's servers which are fast, reliable and tested. Google provides this service free of charge.

Open Source Fonts

All of the fonts are Open Source. This means that you are free to share your favorites with friends and colleagues. You can even customize them for your own use, or collaborate with the original designer to improve them. And you can use them in every way you want, privately or commercially — in print, on your computer, or in your websites.

We are working with designers around the world to publish quality typeface designs that are made for the web. If you are a type designer and would like to discuss this, please get in touch.

Many of Google's own web pages are already using Google Fonts, such as Google's About page and Google's World Wonders Project which use Open Sans.

— The Google Fonts Team

 






PARTNERS