Search the Community

Showing results for tags 'rotation'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 164 results

  1. Hey GameDevs, I'm using TexturePacker to make a sprite atlas. When I use the 'MaxRects' setting it makes an optimized sprite sheet, rotating some of the images to tuck them all in nicely. But when I run my game I receive this message from the console: Phaser.Loader - textureatlas[spritesheet]: Texture Error: frame does not fit inside the base Texture dimensions [object Object]and each sprite appears as the whole sprite sheet. However, if I set Algorithm to 'Basic' instead of 'MaxRects' the resulting sheet contains all the images without rotation, and the sheet works perfectly in my game. But the sprite sheet image dimensions are way bigger than they need to be and there is a lot of wasted space. Has anyone come across this? Is there a line of code in Phaser I can use to get around this issue? Thanks for your help!
  2. Hi there, noob here. I'm looking for a way to make the FreeCamera rolling (rotating around Z axis) using keyboard, a key for clockwise rotation and another for reverse clockwise rotation. This way I can control for instance a spaceship in 1st or 3rd person POV in space. I've games like Wing Commander or Descent in mind. Sorry if it has already been answered, I've not been able to find it. Thanks in advance.
  3. Hey guys, I wanted to use the lookAt function and then get the rotation of the mesh. But it seems the rotation doesn't actually change when using lookAt. Why is that? And is there a way to get the new rotation somehow? http://www.babylonjs-playground.com/#1QM99D
  4. goide

    Rotation Animation

    A question. I need to rotate an animation, in the direction of another object. Create a method that allows me to do this. but for a sprite, but when I try to type an object animation, but does not rotate. watch the video, which have two methods, which are angles to me to turn my animation, you work to perfection and the other not. Video: https://db.tt/f01HXSmj Look how the sprite with the same angle, pointing to my hero. and when I use the animation with the same angle and not pointing to it. and when I change the method by spinning according to the pointer, rotating smoothly. the animation changes its angle to the method I use for the angle of the pointer, but the method if it works, to change the angle for the sprite. but to change the angle of the animation is not working. why?
  5. Gerente

    LookAt function

    Thanks to this amazing forum I have learn a lot of things, I have not found the function mesh.LookAt(mesh), does it exists? Im my demo I can move the text around the pivot vector3.zero but the text should be always looking at the point zero. How can I do that?. How to I get the normal of the plane?, UpVector, DownVector, etc.... ? http://www.babylonjs-playground.com/#1282WV#5 Thanks
  6. Is there a way to make the arcRotateCamera snap to certain points? I want it to snap to areas of interest when its being spun around only on the Y-axis.
  7. DigitalHilsone

    Rotating items

    Hello! For my project I want to re-arrange an interesting feature: the rotation of the object by clicking in the right direction (and of its movement) on the principle of moving the spacecraft to point and rotation to the desired degree. How can I make such a function? Example attached.
  8. goyeneche

    Enemy rotation AI degrees problem

    Hi, yesterday i was struggling with rotation of an enemy. In my game you drive a spaceship and the enemies should rotate to your location in the nearest way (left or right), so they can follow you. This seems to be simple, but i find some problems in the rotation degrees. First i have to find the angle that the enemy should have, to point to my spaceship. I find two ways to do it. The first doesn't work: angle = game.physics.arcade.angleBetween( this , player ); // returns angles between something like 3.1 and -3.1// ( this = Enemy class )I don't know why. Maybe because i am using p2 physics and not arcade? The second works: angleRadians = Math.atan2(this.position.y - player.position.y, this.position.x - player.position.x);angle = Math.atan2(this.position.y - player.position.y, this.position.x - player.position.x) * 180 / Math.PI;// returns 180 to -180So i use that instead. Here I find something strange, the 0┬░ angle in the Enemy is on Top. But, the 0┬░ angle returned in the var angle is on the left. ( both ways in clockwise ) Finally i try doing something tricky like this, but doesn't work properly: if( this.body.angle+180 - angle-90 <= 180 && this.body.angle+180 - angle-90 >= 0 ){ this.body.angle += .6;}else{ this.body.angle -= .6;} May if I figure out why the degrees are different, i can get it work. Thanks!
  9. Greetings to all.I go straight to the point - I can not make the turn the ship according to the direction of flight. There is a lack of experience and knowledge. Please help.I laid out a project on their own domain and put the source code. Thanks in advance. And finally the question - who can help with the project by writing tips? Also, I can tell you about all those interested in the project through private messages.
  10. Hello, I try to make a shooter game with Phaser 2 but i encounter problems to rotate the player sprite and the player hitbox in the same time ... I simplidied my code to keep only the rotation of player : function create() { game.physics.startSystem(Phaser.Physics.ARCADE); player = game.add.sprite(200, 200, 'player'); game.physics.arcade.enable(player); player.anchor.set(0.5, 0.5);}function update() { // player rotation player.rotation = game.physics.arcade.angleToPointer(player); // hitbox rotation player.body.rotate = game.physics.arcade.angleToPointer(player); // player.body.rotation = game.physics.arcade.angleToPointer(player);}function render() { game.debug.body(player, "#9090ff", false);}Result : Init : player_rotate1.jpg And when i move the mouse : player_rotate2.jpg And What i try to make : player_rotate3.jpg Second question : Can i change hitbox type into a circle with Arcade library ? I made it with Box2D library : game.physics.box2d.enable(player);player.body.setCircle(14);but i don't want import two librarys ( and i can't rotate the player with this library ) Regards, Spalac
  11. Is it possible to change the default 0 point of a sprite's rotation? So when a sprite rotates to say 135*, 135* becomes the new 0 point? Help is greatly appreciated!
  12. Is it possible to change the default 0 point of a sprite's rotation? So when a sprite rotates to say 135*, 135* becomes the new 0 point? Help is greatly appreciated!
  13. Stephen Persson

    rotation and getbounds

    I'm using Phaser 2.3.0 and I want to know the bounds of a rotated sprite. But when I change sprite.rotation, the values of sprite.getBounds() don't change: var sprite = game.add.sprite(0, 0, "sprite"); // game.load.spritesheet("sprite", "spritesheet.png", 32, 32);console.log(sprite.getBounds()); // Object { x: 0, y: 0, width: 32, height: 32, type: 22 }sprite.rotation = 0.52; // 30┬░console.log(sprite.getBounds()); // Object { x: 0, y: 0, width: 32, height: 32, type: 22 }What's wrong?How can I get the correct bounds?
  14. Stephen Persson

    ..

    .
  15. Hi! Is it possible to render a rotated DisplayObject into a RenderTexture. Atm it looks like "RenderTexture.render" and "RenderTexture.renderXY" just ignores rotation on the object. My current solution is to use "BitmapData.draw" which works fine. But I'm still wondering why RenderTexture ignores the rotation? Cheers, Klaus
  16. Hello developers, I want to ask you a question ( it could be silly but I can't find anything that works in the forum or other articles ). I want to rotate one line around a circle and I will attach an image to understand me perfectly what i mean. So i searched a lot about rotation of sprites with Phaser but I can't find a working example or a working function that will do what I want. I'm pretty sure my thing is not a big deal so it should be available to be done. I hope you can help me, Nick.
  17. kyptov

    How to rotate frame Texture

    I have one sprite with shots curtov.hol.es/pixiloader/blasts.png I need to make array from texture and use them later. To make sprite I used TexturePacker and some frames was rotated. So I have the next code from json file exported by TexturePacker var frames = [{"filename": "11_protoss","frame": {"x":403,"y":387,"width":58,"height":37},"rotated": true},{"filename": "11_terran","frame": {"x":433,"y":377,"width":42,"height":6},"rotated": true}]To rotate texture I used DOC and generateTexture() texture = new PIXI.Texture(baseTexture, frames[i].frame);if (frames[i].rotated) { doc = new PIXI.DisplayObjectContainer(); sprite = new PIXI.Sprite(texture); sprite.rotation = - Math.PI / 2; doc.addChild(sprite); texture = doc.generateTexture();}Everything fine in Chrome, but all rotated in FF without transparency.http://curtov.hol.es/pixiloader/
  18. Hi folks, here I am bothering you on this forum hahaha. I've tried, unsuccessfully, to rotate a tree so it can be perpendicular to the surface of an sphere at some point. You can see what I did at http://uvshop.co/mimundo/. (I have use, without his permission, @Temechon trees, you can visit his tutorial here) The trees positions are genereted by using a random theta and phi angles: Here is a pic And heres is another Thanks in advances and sorry for my bad english
  19. hellspawn_bg

    Sprite body rotation

    Hey guys, I have noticed that when I rotate my sprite by altering the angle, the physical body of the sprite doesn't get rotated. Any ideas why? Here is my code: preload: function() { this.starShip = this.add.sprite(this.world.centerX, this.world.centerY, 'starShip'); this.starShip.anchor.setTo(0.5, 0.5); // Needed for the collision detection this.game.physics.arcade.enable(this.starShip); }, update: function() { // Player turns left if (this.cursors.left.isDown) { this.starShip.angle -= 3; } // Player turns right else if (this.cursors.right.isDown) { this.starShip.angle += 3; } }, render: function() { this.game.debug.body(this.starShip); }And here is the result: Thanks
  20. Hi, I'm relatively new to Pixi. I have a problem similar to the one mentioned in this post: http://www.html5gamedevs.com/topic/5766-bunny-drag-example-with-correct-mouse-offset/?hl=%2Bdrag+%2Bpixi I used the code from the post and it worked seamlessly. However, when i began rotating the Sprites the offset became wrong, and the sprite jumps to another location when i begin dragging it. Do i have to use some trigonometric function to reverse the rotation? How can I do this? Here is a version with rotation: http://jsfiddle.net/cXfpq/2/ Here without rotation: http://jsfiddle.net/dirkk0/cXfpq/ Thanks in advance! Felix
  21. kcurtin

    Help managing sprite orientation

    I am using some art of a player character for a top down game I am making - the art is here: http://opengameart.org/content/top-down-mage-animations The sprite is orientated so that the mage's face / front is facing upward (north). I'm having some issue with rotation, with both mouse movement and keyboard movement. For example, I have this "hack" that adds additional radians to a calculated angle in order to get the mage's "front" to face the pointer instead of the right shoulder: this.rotation = this.game.physics.arcade.angleToPointer(this, pointer) + 1.57079633; Is there an easier way to handle this? I'm running in to the same issue attempting to use angular velocity for keyboard movements: this.game.physics.arcade.velocityFromAngle(this.angle, 300, this.body.velocity); The goal is to get wasd to rotate and move the character similar to the example here: http://examples.phaser.io/_site/view_full.html?d=arcade%20physics&f=angular+velocity.js&t=angular%20velocity) What is the best way to get the front of the sprite to face the direction the sprite is moving? I will also be having objects that "shoot" out from the front of the sprite, which will have to be based on it's rotation so I'd rather calculate the offset a single time instead of all over the place... Let me know if this makes sense. Thank you!
  22. cityrock

    rotation and angles

    Hello, I am very very new to phaser and just started playing around with it. I am trying to find a way in which i can rotate (using rotation, angle or any other method can be advised) the world of a game in which the center point of rotation is the center of the camera, and not position 0,0 of the world itself. This means the center point for rotation is dynamic and based on the center point of the current camera. Is it possible to do with phaser? I believe I am looking for a way to offset the point of rotation for the world object of the game. Thanks in advance Eli
  23. yuccai

    Rotation issue

    Hello ! There are something i don't understand regarding mesh rotation. 1) i find the y positive rotation wrong but maybe it's because the basis is indirect. 2) when i rotate a mesh, does its rotation axis also turn? Here is an example : http://www.babylonjs.com/playground/#XXH6D#5 There are 4 boxes : box1.rotation = (0,0,0) box2.rotation = (0,0,0) box3.rotation = (PI/2,0,0) box4.rotation = (PI/2,0,0) in the render loop box1.rotation.z += 0.01 box2.rotation.y += 0.01 box3.rotation.z += 0.01 box4.rotation.y += 0.01 there is no problem for box1 and box2 (even if i think that box2 should turn in the other way) but box3 and box4 are turning on the same axis in opposite way. I don't understand why. Thank you
  24. I'm getting up-to-speed on developing with Babylon.js and I'm having a problem with physics simulations and initial rotation on a mesh: You'll notice that the box and the ball bounce off the air above the "ground." My expectation is that both the box and the ball would land on the surface of the ground. It works as expected if there is no initial rotation. The greater the rotation, the more obvious the problem. Here's how I'm rotating the ground: var ground = BABYLON.Mesh.CreateBox("ground", 10, scene);ground.rotate(BABYLON.Axis.Z, .3, BABYLON.Space.LOCAL);ground.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, friction:0.5, restitution: 0.4});If it helps, here's all the code I'm using to create the scene: var createPrototypeScene = function(engine) {var scene = new BABYLON.Scene(engine);var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 10, -40), scene);var light0 = new BABYLON.DirectionalLight("Omni", new BABYLON.Vector3(-2, -5, 2), scene);var light1 = new BABYLON.PointLight("Omni", new BABYLON.Vector3(2, -5, -2), scene);camera.setTarget(new BABYLON.Vector3(0, 0, 0));scene.enablePhysics(null, new BABYLON.CannonJSPlugin());// Create the groundvar ground = BABYLON.Mesh.CreateBox("ground", 10, scene);ground.rotate(BABYLON.Axis.Z, .3, BABYLON.Space.LOCAL);ground.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, friction:0.5, restitution: 0.4});// Create the ballvar ball = BABYLON.Mesh.CreateSphere("ball", 16, 1, scene);ball.material = new BABYLON.StandardMaterial("ball", scene);ball.material.wireframe = true;ball.position = new BABYLON.Vector3(3, 20, 0);ball.setPhysicsState(BABYLON.PhysicsEngine.SphereImpostor, { mass: 5 });var box = BABYLON.Mesh.CreateBox("box", 3, scene);box.position = new BABYLON.Vector3(0, 15, 0);box.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass: 1});return scene;}Thanks!
  25. Animated mesh exported from 3DS Max 2013 using the babylon exporter. Please see the link: Adjusting the scale, rotation, and position doesn't get applied to the actual mesh. Babylon Model Files: Max Scene: BABYLON.SceneLoader.ImportMesh("", "../Models/Monsters/", "Boss_Pukui.babylon", scene, function (mapZone, particleSystems, skeletons) { mapZone[0].rotationQuaternion = null; mapZone[0].scaling = new BABYLON.Vector3(0.0005, 0.0005, 0.0005); mapZone[0].rotation = new BABYLON.Vector3(0, -3.141593, 0.000000); mapZone[0].position = new BABYLON.Vector3(-104.0314, 4.3437, -14.2259); } );