Pivot

Posted By: Alberto

Pivot - 04/08/06 10:48

hello

What about a "pivot" feature Blitz3d Like ?
I have been using Blitz for years and I found it really so helpful
Posted By: Anonymous

Re: Pivot - 04/08/06 11:16

Describe, please? What is it about and what does it do?
Posted By: Alberto

Re: Pivot - 04/08/06 11:43

You create an invisible entiy called "pivot" as a parent then you attach children entities to it
For example in a solar sustem the pivot can be the sun origin while the earth is a child
You rotate the pivot and the earth turns around the sun
This is a simple example but beleive me it is a powerful tool
In an other thread I have been suggested to move in MED the center of the model
It can work for a door, for example, but it is not a general purpose solution
Posted By: A.Russell

Re: Pivot - 04/09/06 02:42

You can do the same thing using vec_rotate. 3DGS doesn't allow you to organise your entities into parent-child heirachies, so you will have to manage that yourself.

An example of rotating something about a point:

Code:

action orbit
{
var angular_velocity[3];
vec_set(angular_velocity, vector(5,0,0); //5 degrees pan per tick


while(my)
{
//velocity to pivot
vec_set(temp,angular_velocity);
vec_scale(temp, time);

//length and direction of vector to rotate
vec_diff(temp2, my.x, parent_entity.x );

//rotate it
vec_rotate(temp2, temp);

//add it back to the parent entity's position
vec_add(temp2, parent_entity.x);
vec_set(my.x, temp2);

wait(1);
}

}



Untested, but should do the job.


EDIT>>> Actually ,that would just rotate the object around the level origin. You need to find the length and direction of the parent entity to the child, rotate that around the origin then put it back. I have changed the above code to do this.

Yes, a single command that does all that would be convenient.

Posted By: Alberto

Re: Pivot - 04/09/06 08:07

3DGS doesn't allow you to organise your entities into parent-child heirachies,

Thanks , it is an important feature anyway
As I said I have been using it a lot in Blitz3d
Can it be implemented also in 3dsg in the future ?
Posted By: A.Russell

Re: Pivot - 04/09/06 14:52

You can do it yourself. Set an entity skill for a pointer to the parent and another for any children.

With respect, this isn't Blitz3d, so although that may be your frame of reference for how 3d engines work, you'll have to get used to the way the engine you are working with handles things or just stick with one engine that you know.
Posted By: Alberto

Re: Pivot - 04/09/06 15:13

No offence but this is a silly answer
Posted By: oliver2s

Re: Pivot - 04/09/06 16:09

Quote:

No offence but this is a silly answer




No, this:
Quote:

You can do it yourself. Set an entity skill for a pointer to the parent and another for any children.





is a very good solution...
Posted By: Alberto

Re: Pivot - 04/09/06 16:25

I referred to Russel's comment not to his solution
Posted By: Alberto

Re: Pivot - 04/09/06 16:38

I have been also surprised of Russel's, in my opinion silly answer because he himself in his previous post said

"Yes, a single command that does all that would be convenient "

The sub title of the "future" thread is "suggestion..."
and then ?
Posted By: Pappenheimer

Re: Pivot - 04/09/06 17:04

At least, there is nothing silly in your suggestion, Alberto, it sounds quite interesting to me. It could spare a bunch lines in coding for a very basic and often used function.

Can you tell some examples what for you used it?

I think it makes easier to understand a suggestion, if one knows the purposes.
Thank you!
Posted By: A.Russell

Re: Pivot - 04/09/06 18:02

Parent-child heirachies are used in quite a few engines, and in other software. Anything done to the parent will affect the child. For example, if I move an entity, all its children will move, too.

You are absolutely right, too. You posted here in the Future forum, so you weren't looking for alternative solutions to your problems, you wanted Contitec to implement these Blitz3D features for you. Good luck, and I won't reply anymore.
Posted By: Alberto

Re: Pivot - 04/09/06 18:12

PappenHeimer

For example to create a camera following the player
You create pivot and you attach it to the player then you make the camera child to the pivot
Posted By: Pappenheimer

Re: Pivot - 04/09/06 22:29

Does it affect the camera's turn/rotate (pan etc.), too?
And can it affect the turn/rotate only?
And, if you attached it can it be 'de-attached' it easely, or is it attached for the whole time when it is called once?
Posted By: jcl

Re: Pivot - 04/10/06 09:04

Rotating of child entities about its parent can be very easily implemented by a small script - so, unlike with BlitzD, it does not make much sense here to build this into the engine. It would not be any faster or have any other advantages over a script.

You can however post this suggestion onto the template forum for Doug to provide a general purpose script for this. Give some examples how you would use this feature.
Posted By: ROMAC

Re: Pivot - 04/10/06 22:11

Quote:

Rotating of child entities about its parent can be very easily implemented by a small script - so, unlike with BlitzD, it does not make much sense here to build this into the engine. It would not be any faster or have any other advantages over a script.

You can however post this suggestion onto the template forum for Doug to provide a general purpose script for this. Give some examples how you would use this feature.




Only because this is 3dgs I'll respond to what is said above. 3dgs is meant to be an easy to use engine - even without script - therefore I agree this feature could be a possiblity to implent instead of putting it through code.
I personally, don't need it, this is just generally speaking. But a template for beginners is also a way to go with it.
Posted By: Alberto

Re: Pivot - 04/13/06 17:26

Does it affect the camera's turn/rotate (pan etc.), too?

The camera pan, no
Actually you create an orbit camera
you turn the pivot and the camera moves around the player
yes ,it can be de-attached
Posted By: Matt_Aufderheide

Re: Pivot - 04/14/06 00:47

I do think that having some kind of parent-child system that is easy to use would be a good thing. While you can do this with pointers and handles, sometimes i have wanted an easy way to simply "destroy all children entities". So instead i have to make some junky function that loops through all objects or has some linked list or whatever..It would be nice if you could set the parent object at creation, and then that parent object can have a special function like:

remove_child_ents()
hide_child_ents()

or whatever....

and of course the child objects would get a special pointer "parent" ..
© 2024 lite-C Forums