Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
C_Rotate About Different Axis #406468
08/21/12 05:40
08/21/12 05:40
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Hi, can anyone provide a short snippet about how to c_rotate an object about a different axis? Ie: Rotate a cube that is always 50 quants in front of the player using the player's axis as the point of rotation.

Re: C_Rotate About Different Axis [Re: 82RJZAE] #406471
08/21/12 08:02
08/21/12 08:02
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
here you go wink
Code:
vec_set ( vtemp, vector ( key_force.y, -key_force.x, 0 ) );
vec_normalize ( vtemp, 15 * time_step );
c_move ( player, vtemp, nullvector, GLIDE );
vec_set ( camera.x, player.x );
		
camera.pan -= mickey.x * time_step * 3;
camera.tilt = clamp ( camera.tilt - ( mickey.y * time_step * 3 ), -80, 80 );
player.pan = camera.pan;

vec_for_angle ( vtemp, camera.pan );
vec_normalize ( vtemp, 50 );
vec_add ( vtemp, player.x );
vec_sub ( vtemp, Object.x );
c_move ( Object, nullvector, vtemp, GLIDE );

vec_diff ( vtemp, camera.pan, Object.pan );
c_rotate ( Object, vtemp, NULL );



Salud!

Re: C_Rotate About Different Axis [Re: txesmi] #406478
08/21/12 09:49
08/21/12 09:49
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Wow thanks! laugh How can I prevent the cube from tilting up and down with the camera now?

Re: C_Rotate About Different Axis [Re: 82RJZAE] #406479
08/21/12 10:05
08/21/12 10:05
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
you might change the angles involved in the c_rotate instruction.

Salud!

Re: C_Rotate About Different Axis [Re: txesmi] #406480
08/21/12 10:23
08/21/12 10:23
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Thanks again! One more question: any idea how to prevent the corners of the model from intersecting with the wall? The intersection occurs regardless if c_setminmax is set or not. I have enabled the GLIDE flag on both c_move and c_rotate as well.



Re: C_Rotate About Different Axis [Re: 82RJZAE] #406484
08/21/12 13:26
08/21/12 13:26
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I think you can increase the collision ellipsoid or set the POLYGON flag to the object.

Salud!

Re: C_Rotate About Different Axis [Re: txesmi] #406498
08/21/12 21:03
08/21/12 21:03
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Nope, the POLYGON flag had no effect on the object. frown

Re: C_Rotate About Different Axis [Re: 82RJZAE] #406655
08/27/12 04:33
08/27/12 04:33
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
POLYGON can't help here, I'm afraid.

An entity with their POLYGON flag will be a per-polygon obstacle to other objects using c_move, but when it uses c_move it'll use an ellipsoid hull.

GS's collision detection options are extremely limited, unfortunately, and previous requests for improvements in this area were deemed too much work. You're better off somehow taking advantage of PhysX, or a collision-detection plugin, or writing your own collision detection, or settling for ellipsoids.


Formerly known as JulzMighty.
I made KarBOOM!
Re: C_Rotate About Different Axis [Re: JibbSmart] #406714
08/27/12 18:07
08/27/12 18:07
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I think the better way for you will be to make collusion's ellipsoid a little bit bigger.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1