|
Post by rasto on Jun 4, 2014 22:57:32 GMT
Is there a way to adjust the pivot point for objects to rotate around?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 5, 2014 3:36:22 GMT
As I know , you can put that object into a timeline , and the default rotation pivot point will be timeline center (0,0). If you move that object a little , you will see the rotation point never changed (0,0), but the object seems rotate around that point . Perhaps there is a more simple way to do that , but I'm not sure how.
regards.
|
|
|
Post by Hippani on Jun 5, 2014 6:39:00 GMT
There's no way at the moment. There used to be but we replaced it with curve transitions. It was had to do both in HTML so we decided to just choose one. You can achieve the same effect as moving a pivot point using curved transitions. Check out our old cats shadow and aeroplane demos.
|
|
|
Post by runes on Jun 17, 2014 10:15:36 GMT
This is sort of unrelated to the original question... But it has to do with pivot points (sort of).. I'm trying to make a game where the objects of a level rotates around the player (which is always at center of screen). I've tried some different things but it's a bit over my head. I'm more of a graphic artist than programmer (and also bad at math). rotatearoundplayer.hani (940 B) Does anyone with some experience in programming that sort of thing have any suggestions for that?
|
|
|
Post by Hippani on Jun 17, 2014 13:30:44 GMT
I'm not 100% sure what you're trying to do. The maths to rotate around a point is:
var R=100;//Radius var X=300,Y=200;//Center var Angle=0; //Angle var PX=X+(R*Math.cos(Angle)); //X point var PY=Y+(R*Math.sin(Angle)); //Y Point
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 17, 2014 14:17:48 GMT
This is sort of unrelated to the original question... But it has to do with pivot points (sort of).. I'm trying to make a game where the objects of a level rotates around the player (which is always at center of screen). I've tried some different things but it's a bit over my head. I'm more of a graphic artist than programmer (and also bad at math). Does anyone with some experience in programming that sort of thing have any suggestions for that? Dear runes : I fixed your source code so you may download it here : RotateAroundPlayer.hani (1.43 KB) It is a liitle small tricks by using math , which called "Vector". please try this and see what you wants to do more. regards. FlashKnight
|
|
|
Post by runes on Jun 18, 2014 15:39:54 GMT
Thank you both. That was informative. I've been searching for something like the lookAtTarget function for different projects, so thank you very much Flashknight! However I haven't solved my issue just yet. I've made a quick animation to show what I'm trying to accomplish: stowasser.dk/rotatearoundplayer/What I'm trying to show here is that the entire environment moves around the player (like a camera following the spaceship). The problem is that Angle and Radius needs to be updated continuously because they change when moving up and down... So how do I find angle and radius from current position
|
|
|
Post by Hippani on Jun 18, 2014 17:27:40 GMT
Hmmm.. Some game math functions might be handy feature to add. I'll suggest it.
|
|
|
Post by Hippani on Jun 19, 2014 12:22:52 GMT
Finding an angle is something like this:
var xDiff = X1 - X2; var yDiff = Y2 - Y2; var Angle=Math.atan2(yDiff, xDiff);
The result is in radians.
|
|
|
Post by runes on Jun 30, 2014 6:47:29 GMT
Hmmm.. Some game math functions might be handy feature to add. I'll suggest it. I was thinking about this for a few days now. I'm not sure how that would be implemented the best way. Then I thought that since it's possible to add js files, maybe you should just have a place where you could upload files with just a single function in it. And then a browser similar to the Demos in the menu to make it easy to use. In this scenario a function could be anything from a simple calculation to complicated physics implementation. Users can edit existing functions to suit their needs and some of us could learn alot from just looking at the code. Also this approach could open up for user contributions from users like FlashKnight, who are strong with programming and math to the benefit of those of us who are not so strong
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 30, 2014 8:14:22 GMT
I know how to do that , but I am a little busy on a very large demo , so I may not have time to write that. So I just say it: 1. you need to build world , all things goes inside it. 2. you need a technical item called the "Camera". thinking you are taking a picture , and them you can rotate the camera , it will seem like you are rotate the whole world. 3. now rotate the camera. to implement this , you need to build a game inside the world, and communicate with camera. the camera can be implements by a iframe. runes please check that.
|
|
|
Post by Hippani on Jun 30, 2014 8:43:32 GMT
User submitted functions is a suggestion we've had before. We are considering adding functions like DistanceBeweenPoints(X1,Y1,X2,Y2);
|
|