ActionScript 2.0 :: Rotating To Face Something
Oct 13, 2004is it possible to rotate an object so that it always faces another object that is able to move around the screen? as in track it on the y and x axis?
View 2 Repliesis it possible to rotate an object so that it always faces another object that is able to move around the screen? as in track it on the y and x axis?
View 2 RepliesAll I need to do is rotate an object (which could spawn at any point along each of the four edges of the screen) so that it faces towards the centre of the screen. Obviously this will be done using the .rotationZ property. I will know the starting point of the object, and the centre point of the screen (400, 300). The object begins facing directly 'up' (e.g. if it spawned directly below the centre of the screen it would already be at the correct angle).
View 2 Repliesi am currently having trouble with my object rotating to face another object.currently it works fine as in this picture, my object at the origin will be able to rotate and move to the object in the 3 quadrants except the quadrant with positive 90degrees to 180 degrees, my object will rotate a few full rotation for some time while moving to the object does anyone know why? the sentence that i use to rotate is rotation += (foodLocationDegrees - (rotation - 90)) * .2; whereby food is calculated using
[Code]...
currently i have a function in which my object fish will move to a food i am having trouble getting it to rotate nicely to the food currently my function is as below.if the food is above the fish my fish rotation is 0 which is facing up, if the food is below my fish i will give it a rotation of 180 which will make it face down , however the rotation is too sudden it does not give a nice and realistic effect of rotating to the food.how can i make it when rotating to move some distance and at the same time rotate? because it cant rotate to the food in the same spot as it would not be realistic.
public function moveToFood():void
{
var foodTarget:Food = fishArray[fishArray.length - 1];
[code]......
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?
View 8 RepliesI'm recently playing with Away3D Library and have a problem in finding Face center in Away3D. Why Away3DLite has a face.center feature while Away3D doesn't have it ? and what is the alternative solution for this ?
View 1 RepliesI have the project where I need to use papervision3d engine. It's 3d model of building. Each floor is separate .dae model embedded within swf file. Everything is okay regarding performance, but z-sorting of BasicRenderEngine is making me sad. If you take a look over attached image you will see that sometimes wall faces appear above cover and backwise, cover faces appear above wall. Each floor model was made with Swift3d by path extrussion. It has two types of material: one for wall and another for cover. Is there any way I can go through all faces and regading material applied to it assign them ViewportLayer and sort index ?
I tried to use QuadrantRenderEngine, it does correct z-sorting, but is CPU killer.
I have a flash movie i would like to create that will be around 400px x 500px.
I would then like to have a rhino charging towards you (the user) so it would have the effect that the rhino is trying to break the screen to charge at you (face on) but it stumbles because of the glass on the screen.
how they would go about this animation?
I am making a simple Flash animation that I would like to put online and let people visiting my site upload a picture of their face so they can be the character, like on Elf Yourself. How do I do that? I'm assuming I make the animation with a square image of a face that I mask out, and the image gets replaced when a new one is uploaded, but I don't know how to set that up dynamically, or if there's a better way.
View 3 Replieswhat is involved to create a Flash file where the user can upload a .jpg of their face, crop it, and then add that picture to an animation? I'm sure you've all seen this...sort of a jib-jab type animation.
View 1 RepliesI'm trying to accomplish something with flash but I'm having some problems, if not a solution I'm hoping someone can tell me a method and what I should read up on to do this: I want to have an image on the stage that has a gap the shape of a face in the middle of it, I'd then like to put a webcam feed behind it so people can line their face up in the gap and press a button to take a picture. (I've managed to put the webcam on the stage and take the picture but can't work out how to put it behind an image). Then I cant quite work out how I'd put the face onto a character I've drawn.
View 1 RepliesI got a working code to detect face in flash. It just detects and draws a square mark over the face displayed in flash player. Now I do need when ever a face is detected automatically a photo to be taken. How to implement this? Is there any open source project available for this?
View 1 RepliesI am trying to map an image(webcam image or dynamic image) on an collada object(head). In fact I have a head, and I would like to put my face on it . Something like that[url]..
How to stretch the dynamic picture so it can fit the mapping ? Match the eyes with the eyes, the nose with the (UV map) nose,... and draw the new bitmap
I'm trying to get my font to change when clicking a button.
The text field itself is inside a movie clip called draggabletext. The inside text field is called tfield, and is dynamic with a var: output2. It renders as HTML (but doesn't have to if you have a better solution). It gets its text from a different input field.
I have a "dropdown" menu with 2 buttons (instance names arial and georgia).
On the root I have this code:
Code:
onEnterFrame = function() {
draggabletext.output2 = "<font face="" +textface+ "" color=""+textcolor+"">" + inputBox.text + "</font>";
[Code]...
I have embedded the fonts. Still, I can not get the text to change between the font faces when I click the buttons.
Since each face of the Script 3D rotating cube is a movieclip, I thought you could load an image on it. I couldn't get that to work.
View 2 RepliesI'm making a top down shooter and I'm encountering some interesting code lag with the function I'm using to make the player face the mouse.
Code:
//The function is called through a ENTER_FRAME listener.
//mX & mY are the current position of the mouse.
public function facePoint(mX, mY){
if(this.visible){
this.rotation = (-Math.atan2((this.x - mX),(this.y - mY))) * 180 / Math.PI;
}}
If I hold down two movement keys and then spin the mouse around the character really fast, it builds up some kind of buffer that sends the character out of control for a few seconds, even after you've released the keys. Just discovered that reducing the quality to low removes the issue entirely... so its a graphics problem. How to avoid this?
I have a flash movie i would like to create that will be around 400px x 500px. I would then like to have a rhino charging towards you (the user) so it would have the effect that the rhino is trying to break the screen to charge at you (face on) but it stumbles because of the glass on the screen.
Can anyone point me in the right direction of executing this or advise on how they would go about this animation please?
I have a symbol which stays stationary, and another symbol that moves around when I use the arrow keys.I want to make symbol1 (stationary one) to face symbol2 (the one I move).I'm guessing using _rotation to make it face it depending on symbol2's _x and _y position?
View 4 RepliesI have a symbol which stays stationary, and another symbol that moves around when I use the arrow keys. I want to make symbol1 (stationary one) to face symbol2 (the one I move). I'm guessing using _rotation to make it face it depending on symbol2's _x and _y position? Also, I'm using class files.
View 1 RepliesFew days ago I uploaded my flash face morphing application and now I'm thinking of writing an article about creature process.URL... anyone curious about how I made it?
View 5 Repliesam working on face detection and able to implement in flash but i want to do it in flex to protect code, the problem am facing is how to convertcameraBitmap to videoDisplay in Flash Builder / Flex i.e.in as3 (flash) its like thisQuote:
camera = new CameraBitmap(488,366,30,w,h);
camera.addEventListener( Event.RENDER, cameraReadyHandler );
addChild(myvideo);
[code].....
I wouldn't think this to be a very difficuly question to find a solution to. My question is; I have a movieclip with instance name "player" and I am trying to layout it's basic movement properties. I already have made it so that the mc will move up, down, left, and right. Cake. What I am having trouble with is getting the mc to rotate in the designated direction (right = 0 degrees, up = 90 degrees, etc).
I have tried using the xscale 100/-100 strategy, but that doen't do anything for up and down movements.
My code so far is as follows:
Actionscript Code:
playerDirection = 0;setInterval(function () {if (Key.isDown(Key.RIGHT)) {setDirection(0);_root.player._x += 3;}if (Key.isDown(Key.LEFT)) {setDirection(1);_root.player._x -= 3;}if (Key.isDown(Key.DOWN)) {_root.player._y
[Code].....
How would I go about doing this but not directly like 360. like lets say my mouse is to the left of the character the character would than face its left frame I made for him like lets say his left frame is frame 2.
View 8 RepliesI have one character which can face several directions: t, b, l, r, tl, tr, bl, br.The type of camera is top-down 2d
T stands for Top, which is when he is looking to the top of the screen
B = Bottom
L = Left
R = Right
The character can look to other directions, like the Top-Left of the screen, which is tl
How do I calculate which direction he should look to if I only have one variable, rotation?
I have a question about Papervision3D, or perhaps bitmapData, I am unsure where the problem is. I have constructed a program that takes 4 banners and splits them into pieces and then applies those pieces to cubes so that I can make a banner rotator. So after I run my program I have 10 cubes with a piece of a banner on 4 faces(front, top, back, bottom) of each cube. The problem is that some of the faces are oriented incorrectly(spun 180 degrees).
Is there a way in Papervision3D to spin a cube face? The other place I think the problem may be is when I create the bitmapData that will be applied to the cube faces. Is there some way to explicitly define orientation during bitmapData creation?
[Code]...
I'm trying to get a MC to rotate to face the mouse using tween:
Code:
import flash.events.MouseEvent;
import fl.transitions.Tween;
stage.addEventListener(MouseEvent.CLICK,clicks);
var tween:Tween;
function clicks(e:MouseEvent):void {
var dx:Number = mouseX-mc.x;
var dy:Number = mouseY-mc.y;
var angle:Number = Math.atan2(dy,dx)*180/Math.PI+90;
tween = new Tween(mc,"rotation",null,mc.rotation,angle,5);
}
While this works fine, there are certain clicks which make the MC pick the longer route to rotate.
I'm making a platform game. The hero can move around, but the enemies are stationary. My problem is that I want the enemies to face the hero. The first enemy behaves correctly, but the subsequent enemies only behave correctly if I kill all the preceding enemies. I have added the hero and the enemies as Objects and put the enemies into an array called enemies. Both the hero and enemy objects have a direction property and an mc property that refers to their movie clips. This for loop gets called every frame.
for(var i:int = 0; i < enemies.length; i++)
{//face hero
if(hero.mc.x < enemies[i].mc.x) enemies[i].direction = -1;
else if(hero.mc.x > enemies[i].mc.x) enemies[i].direction = 1;
enemies[i].mc.scaleX = enemies[i].direction;}
I have my as2 code for my game im making so far the char can jump and move left and right. make him face the mouse like lets say my mouse is to the x- of my character than I would want his left facing movie clip (which I havent made yet) to be facing that way etc. where I could start heres what I have:
Actionscript Code:
onClipEvent (load) {var ground:MovieClip = _root.ground;var grav:Number = 0;var gravity:Number = 2;var speed:Number = 7;var maxJump:Number = -12;var touchingGround:Boolean = false;}onClipEvent (enterFrame) {_y += grav;grav +=
[Code].....
That's the movement code that lets me move left and right and jump with gravity
HI'm using the "PublishPost" method form the "AS3/Facebook API" to publish in the current user wall, but Facebook returns me a code:200 "Permissions Error", I'm just using the simple following code:
1. --------------------------------------------------------------------- -----------------------------------session = new FacebookSessionUtil( this.API_KEY, this.SECRET_KEY, this.scope.loaderInfo );fbook = session.facebook;session.verifySession();
2.PostTool.postInWall( fbook );
3. (inside a PostTool class)
static public function postInWall( fbook:Facebook, message:String = "... Testing..." ):void {
var post:PublishPost = new PublishPost( message ); var call:FacebookCall = fbook.post( post ); call.addEventListener( FacebookEvent.COMPLETE, completeHandler ); }[code].....
Working on a maze game. When the leftkey is pressed the movieclip (char) should turn 90 degrees to the left.
char.scaleX *= -1;
However, the most important thing is that the character doesnt go through the walls of the maze.And I think thats my problem for implementing the code above.Because it doesnt work properly when i put in here;
if(!mazehit) {
char.y += speed;
char.scaleX *= -1;[code].....