box2d resize bodies arround point I have a compound object, consisting of a b2Body, vector graphics and a list polygons which describe the b2body's shapes. This object has its own transformation matrix to centralize the storage of transformations. So far everything is working quiet fine, even scaling works, but not if i scale around a point. In the initialization phase of the object it is scaled around a point. This happens in this order transform the main matrix transform the vector graphics and the polygons recreate the b2Body After this function ran, the shapes and all the graphics are exactly where they should be, BUT after the first steps of the b2World the graphical stuff moves away from the body. When I ran the debugger I found out that the position of the body is 0 0 the red dot shows the center of scaling. the first image shows the basic setup and the second the final position of the graphics. This distance stays constant for the rest of the simulation. If I set the position via myBody.SetPosition( sx, sy ) the whole scenario just plays a bit more distant for the origin. Any Idea how to fix this? EDIT I came deeper down to the problem and it lies in the fact that i must not scale the transform matrix for the b2body shapes around the center, but set the b2body's position back to the point after scaling. But how can I calculate that point? EDIT 2 I came ever deeper down to it, even solved it, but this is a slow solution and i hope that there is somebody who understands what formula I need. assuming to have a set polygons relative to an origin as basis shapes for a b2body scaling the whole object around a certain point is done in the following steps i scale everything around the center except the polygons i create a clone of the polygons matrix i scale this clone around the point i calculate dx, dy as difference of clone.tx original.tx and clone.ty original.ty i scale the original polygon matrix NOT around the point i recreate the body i create the fixture i set the position of the body to dx and dy done! So what i an interested in is a formula for dx and dy without cloning matrices, scaling the clone around a point, getting dx and dy and finally scale the vertex matrix.


Problem with sensor in box2d I have two bodies one green static sensor (spikes) and one orange dynamic body (brick). I have bullet and it's a dynamic body too, but with bullet flag set. My problem is that when the bullet is moving left to right, it sometimes hits the orange brick instead of the spikes and it flies away. There is code to remove the bullet when it hits spikes. How can I make sure it hits the spikes first?


How can I convert a tilemap to a Box2D world? I want to use Box2D physics and lighting with a .tmx map. How can I "convert" a tilemap to Box2D world? My basic idea is to go through the tiles on the map and create an object for them in Box2D. I'm using the Tiled map editor for the tilemap, and the target platform is PC. Firstly, is this a good solution for my idea? Or is this even possible? Secondly, if yes, then I dont know how to get the tile's position. My code so far public class WorldLoader public static TiledMap map public static void loadMap(String mapName) map new TmxMapLoader().load(mapName) TiledMapTileLayer collisionLayer (TiledMapTileLayer) map.getLayers().get("collision") for (int x 0 x lt collisionLayer.getWidth() x ) for (int y 0 y lt collisionLayer.getHeight() y ) Cell cell collisionLayer.getCell(x, y) if (cell ! null amp amp cell.getTile() ! null) float tileX collisionLayer.getProperties().containsKey("x") float tileY cell.getTile().getProperties().get("y", Integer.class) BodyDef bodyDef new BodyDef() bodyDef.position.set(tileX, tileY) PolygonShape shape new PolygonShape() shape.setAsBox(16, 16) Body body GameWorld.world.createBody(bodyDef) body.createFixture(shape, 0f) shape.dispose()


Rotating kinematic object around a moving point Box2D I'm new at Box2D and I am making a simple game where you control the rotation of the maze and the gravity leads the ball to the exit. The game looks like The problem I want to rotate the maze, and I'm doing it well. It is a kinematic object, so it will only move when I want. But it always rotate on a static pivot, I think that's it's center of mass. Rotating the maze, the ball hits the walls and when too further to the center, it becomes hard to control the movement of the ball by rotating the maze as the centrifugue force is too high for the ball. What I want I want to change the maze's rotation pivot to the ball's position, every game loop frame, so it will rotate around the ball always and I will be able to use only gravity, not centrifuge forces, to lead the ball to the exit. What I tried I already tried to find a function to change the pivot center, or the center of mass, but I only found to change the mass proprieties. It changes the center of mass only if it was a dynamic body. Even the kinematic body having the same localCenter.x and localCenter.y proprieties as the dynamic body, it remains on (0.0 ,0.0) when trying to change it. And when changing the localCenter on the dynamic body, it doesn't rotate at this point anyway, so I'm not sure what to do. Is there any possibility to change the center of the kinematic body all the time? I'm using Box2D Vestion 2.3.2, as you can see on the picture, and Visual Studio 2013 with OpenGL. Thanks!


Why set the position of both b2Body and Box2DSprite? In a game, we add a body for each sprite, the method is createBodyAtLocation (CGPoint) forSprite (Box2DSprite )sprite In which we create the body and we attach it to the sprite in parameter sprite.body body Then we set the position of the body, but later on in the code, in the update method, we also set the position of the sprite to the same position as the body. I was wondering Why are we doing it twice? As we already set the position of the body in the world, and we made a link between the two with sprite.body?


Hill jumping game mechanic like Tiny Wings I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill jumping game mechanic? I've used some basic features of Box2d. I imagine the flying character is just a circle, tapping the screen increases the downward force on the character, and the hills are some sort of curve object from the physics engine. Edit 1 Here's more info I'd like to understand which objects from the Box2d physics library are used to create the bare bones hill jumping mechanic. This mechanic would look like a "curvy" horizontal line that just scrolls across the screen. The most basic shape for this line that comes to mind is a sine wave so that's probably a good starting point. Then there's the character that moves around. Note the character's horizontal position is fixed while the vertical position moves up and down. I'm curious about which Box2d body shape, type etc is used for this character. What are some values for the coefficient of friction that work well? How about the density etc. I've searched around the web for tutorials that ideally will answer the above questions and perhaps provide additional resources regarding efficiency, camera motion and so on.


What's the best way to handle slopes for a platfomer game using Box2D I would like to know if there is any known solution for handling the player's movement on slopes using Box2D engine. I tried to do it using a circle as the player. Everything was fine until I tried to walk on slopes, the main problem is that due to gravity, the circle does not stop on the slope. Please if somebody has tried this before I'll appreciate it. If you have a better solution without the physics engine would be fine for me too. Thank you.


Frame independent box2d object movement In my game I use box2d objects and, as I understand it, you can move them only in two ways, SetLinearVelocity, and ApplyImpulse. I need to move the object 32 pixels in 1 turn. So I make a constant speed and the next problem appears. If the laptop is connected to the charge and gives 60 frames, the object begins to move faster. How do I make frameindependent movement? Without connection 30 FPS and the game makes slowly. I also know that if you want to be frameIndependent you need to use this formula x x speedPerSecond secondsElapsedSinceLastFrame But i cant use this formula, because i cant set box2d position. It is make box2d itself. I only can set the Velocity ( Or may me i just dont know. 2 it is meters per second. 64 pixels. private void handleInput(float delta) if (Gdx.input.isKeyPressed(Input.Keys.W)) b2body.setLinearVelocity(0, 2) if (Gdx.input.isKeyPressed(Input.Keys.S)) b2body.setLinearVelocity(0, 2) if (Gdx.input.isKeyPressed(Input.Keys.A)) b2body.setLinearVelocity( 2, 0) if (Gdx.input.isKeyPressed(Input.Keys.D)) b2body.setLinearVelocity(2, 0) How can i move object in another way or how to make movement frameindependent? SetTransform is not a good decision becasuse collisions are ignored. Thank You!


Speed seems random with constant impulse I'm shooting an object from the top vertex of a triangle using Box2dWeb. The issue I'm having is that the projectile speed seems to be fairly random, even with applyimpulse set to a constant. The gravity is set to zero. I thought it could be the physics step, changing these settings hasn't made a difference. The projectile will shoot out at very very fast speeds, then it will shoot out at its defined speed. bodyman 0 .GetBody().ApplyForce( bodyman 0 .GetBody().GetWorldVector(new b2Vec2(0, 50)), bodyman 0 .GetBody().GetWorldCenter())


Box2dWeb must fixtures be destroyed explicitly when destroying the body? I use b2WorldObj.DestroyBody(bodyObj) to destroy the body when it is not needed anymore. The body has one fixture attached to it. Do I need to destroy the fixture before destroying the body? or should I assume that by destroying the body all its fixtures will be automatically destroyed? Right now, I do not destroy the fixtures explicitly and the game runs fine. But my concern is more about memory leaks. I want to make sure that all the bodies and fixtures that are not used anymore are completely removed from the memory. How can I best achieve this? Thanks!


In Box2D, how do I create an infinitely oscillating spring? How do I create an ideal spring that can oscillate indefinitely using Box2D? A b2DistanceJoint works almost perfectly, but it eventually slows to a stop, even with damping set to 0. I think it is because b2DistanceJoint is not meant for creating springs, but for preserving the distance between two bodies by correction the violated distance with a spring like behaviour. Hence, it should have a damping to eventually bring back the bodies to initial state and stop at some point.


Starter love2d physics program not working I am starting out with my first love2d (using L VE 0.8) physics program. I am just creating some ground floor, a car body and attaching two wheels with revolute joints and setting the motors a go. However, the car stands still, whereas I expect it to move. Can someone glance over the code below and see what I am doing wrong? UPDATE See below! function love.load() Set up world love.physics.setMeter(50) world love.physics.newWorld(0, 9.81 50, true) Window dimensions windim height love.graphics.getHeight(), width love.graphics.getWidth() objects Ground Floor objects.ground objects.ground.body love.physics.newBody(world, 300, windim.height) objects.ground.shape love.physics.newRectangleShape(2000,20) objects.ground.fixture love.physics.newFixture(objects.ground.body, objects.ground.shape) objects.ground.fixture setFriction(3) Body of the car a rectangle objects.carbody objects.carbody.body love.physics.newBody(world, 300, 500, "dynamic") objects.carbody.shape love.physics.newRectangleShape(100,40) objects.carbody.fixture love.physics.newFixture(objects.carbody.body, objects.carbody.shape) objects.carbody.fixture setFriction(3) objects.carbody.fixture setDensity(3) objects.carbody.fixture setRestitution(0) First wheel objects.wheel objects.wheel.body love.physics.newBody(world, 330, 520, "dynamic") objects.wheel.shape love.physics.newCircleShape(20) objects.wheel.fixture love.physics.newFixture(objects.wheel.body, objects.wheel.shape) objects.wheel.fixture setFriction(3) objects.wheel.fixture setDensity(3) objects.wheel.fixture setRestitution(0.6) Second wheel objects.wheel2 objects.wheel2.body love.physics.newBody(world, 270, 520, "dynamic") objects.wheel2.shape love.physics.newCircleShape(20) objects.wheel2.fixture love.physics.newFixture(objects.wheel2.body, objects.wheel2.shape) objects.wheel2.fixture setFriction(3) objects.wheel2.fixture setDensity(3) objects.wheel2.fixture setRestitution(0.6) Create joint between car body and first wheel objects.carbody.wheeljoint1 love.physics.newRevoluteJoint(objects.carbody.body, objects.wheel.body, 330, 520) objects.carbody.wheeljoint1 enableMotor() objects.carbody.wheeljoint1 setMaxMotorTorque(10000) Following example from http www.emanueleferonato.com 2011 08 22 step by step creation of a box2d cartruck with motors and shocks Create joint between car body and second wheel objects.carbody.wheeljoint2 love.physics.newRevoluteJoint(objects.carbody.body, objects.wheel2.body, 270, 520) objects.carbody.wheeljoint2 enableMotor() objects.carbody.wheeljoint2 setMaxMotorTorque(10000) end function love.update(dt) Set contstant speed for the wheels objects.carbody.wheeljoint1 setMotorSpeed(20) objects.carbody.wheeljoint2 setMotorSpeed(20) world update(dt) end function love.draw() love.graphics.print(objects.carbody.wheeljoint1 getMotorSpeed(), 10, 10) Render ground love.graphics.setColor(72, 160, 14) love.graphics.polygon("fill", objects.ground.body getWorldPoints(objects.ground.shape getPoints())) Render car body love.graphics.setColor(72, 160, 200) love.graphics.polygon("fill", objects.carbody.body getWorldPoints(objects.carbody.shape getPoints())) Render wheels love.graphics.setColor(193, 47, 14) love.graphics.circle("line", objects.wheel.body getX(), objects.wheel.body getY(), objects.wheel.shape getRadius()) love.graphics.circle("line", objects.wheel2.body getX(), objects.wheel2.body getY(), objects.wheel2.shape getRadius()) end UPDATE I added a line to print the angle of one of the wheels (see below). When this line is present, suddenly the car flips over from the wheels spinning when it hits the ground. This leads me to believe that something did not get initialized properly first time around. This is the line added function love.draw() love.graphics.print(objects.wheel.body getAngle(), 10, 10) Line added


how to attach a body to a rope and making it swing to another rope I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read making and object swing from one rope to another but it didn't seem to be of any help.


How to keep the value of angle between 0 and PI in box2d In box2d, if i rotate an object multiple times in clockwise or anti clockwise direction, the value of angle ( body.getAngle() ) keeps on increasing. Like at start it is at 0 radians, then 1.57(90 deg), after complete roatation 6.28, then after second rotation 2 6.28 . If a player keeps on rotating for too much time, angle value becomes really big.And for multiplayer games, sending big values uses more bytes. How can i keep the value between 0 to 3.14.Is there any solution in box2d Or Is it a good way of sending Sin(angle) to keep the value between 1 and 1 and doing reverse of sin at client side.


Stopping on a slope in Box2d I am creating a simple platformer using Box2d. I've implemented a variant of the technique described here. To make the player character move more 'platformer like' I want him to stop on (shallow) slopes. However, the engine I am using does not support angle joints, so I have trouble restricting the movement of the wheel. I've tried some different alternatives that not worked Setting the horizontal velocity to 0 every game loop doesn't seem to work, because between calls the wheel catches up speed once again. Is there another way to fix this?


cocos2d Merging box2d bodies i'm using cocos2d to build an iphone game. my game currently has two sprites one for the main character and another for an item i should carry once he gets on him. the main character and the item are both box2d bodies. i can detect the collision between the two. what is want is to make the item body stick to the main character body when they meet, that way any movement of the main character would also affect the item. any suggestions on how to implement this? thanks!


How to make box2d bodies block each other but not push each other? I want to use box2D to create a movement system for an RTS game. How can I make bodies block the movement of other bodies while preventing these bodies from pushing each other?


in box2d how to decrease joint's reaction force? I'm trying to make a game like cut the rope and meet some problems. when I create a float bubble and connect with a rope(a sets of bodies connected with revoluteJoint), the rope will become longer and when I destroy the bubble,rope gives a a big reaction force to candy, so how to decrease this reaction force? to simulate bubble's floating, I did this class Bubble extends PhyObject override function draw() void if(this.combined) this.getBody().SetLinearVelocity(velocity) velocity new b2Vec2(0, 3.5) other code class Main public function loop() getAllPhyObject().forEach(function(phyObj) phyobj.draw() ) so if bubble was combined with candy ,It "float". I think maybe I can do this pseudo code if(bubble is connected with rope) dynamic adjust bubble's linear velocity with rope's reaction force but I just cannot figure out how to dynamic adjust bubble's linear velocity.and is there a simpler way to solve this problem? thanks! update finally I solved my problem,so I write it down and hope it help to you. below code is grab from b2BuoyancyController and it works in my case. buoyancy private function float() void if (bodies.length lt 1) return var body b2Body bodies 0 if(body.IsAwake() false) Buoyancy force is just a function of position, so unlike most forces, it is safe to ignore sleeping bodes return var normal b2Vec2 new b2Vec2(0, 1) var offset Number 20 var density Number 2 var velocity b2Vec2 new b2Vec2(0, 0) var linearDrag Number 2 var angularDrag Number 1 var gravity b2Vec2 toolkit.world.GetGravity().Copy() var areac b2Vec2 new b2Vec2() var massc b2Vec2 new b2Vec2() var area Number 0.0 var mass Number 0.0 for(var fixture b2Fixture body.GetFixtureList() fixture fixture fixture.GetNext()) var sc b2Vec2 new b2Vec2() var sarea Number fixture.GetShape().ComputeSubmergedArea(normal, offset, body.GetTransform(), sc) area sarea areac.x sarea sc.x areac.y sarea sc.y var shapeDensity Number 1 mass sarea shapeDensity massc.x sarea sc.x shapeDensity massc.y sarea sc.y shapeDensity areac.x area areac.y area massc.x mass massc.y mass if(area lt Number.MIN VALUE) return Buoyancy var buoyancyForce b2Vec2 gravity.GetNegative() buoyancyForce.Multiply(density area) body.ApplyForce(buoyancyForce,massc) Linear drag var dragForce b2Vec2 body.GetLinearVelocityFromWorldPoint(areac) dragForce.Subtract(velocity) dragForce.Multiply( linearDrag area) body.ApplyForce(dragForce, areac) tmpForce if(candy.bodies.length gt 0) TODO !!!!! var tmpForce b2Vec2 candy.bodies 0 .GetLinearVelocity() body.SetLinearVelocity(tmpForce) tmpForce.x 0 tmpForce.Subtract(velocity) tmpForce.Multiply( linearDrag area) body.ApplyForce(tmpForce, areac) Angular drag TODO Something that makes more physical sense? body.ApplyTorque( body.GetInertia() body.GetMass() area body.GetAngularVelocity() angularDrag) tips use force instated of impulse and changing linear velocity.


Why won't my Box2d bodies collide? I'm doing something wrong when trying to get bodies to collide using jBox2d amp Slick2d. Here is have just my basic init, update, and render methods. Render and update seem to work fine for drawing (gravity effectively pushes the ball down, and will rotate if I apply an impulse). I have a feeling I'm overlooking something when creating the edge, but I have no idea what. My shapes bodies work fine in the testbed, but I'm having no luck in my standalone application. I have experimented with moving the edge body ball body around, but it doesn't seem to have any effect. Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException world new World(new Vec2(0F, 9.8F), false) windowCenter new Vec2(gc.getWidth() 2, gc.getHeight() 2) circleShape.m radius CONSTANTS.BALL RADIUS CONSTANTS.SCALE FACTOR circleFixtureDef.shape circleShape circleFixtureDef.density 1f circleFixtureDef.restitution .6f circleBodyDef.type BodyType.DYNAMIC circleBodyDef.bullet true circleBodyDef.position.set(windowCenter) circleBody world.createBody(circleBodyDef) circleBody.createFixture(circleFixtureDef) bottomEdge.setAsEdge(new Vec2(0, gc.getHeight()), new Vec2(gc.getWidth(), gc.getHeight())) bottomEdgeDef.position.set(0f, gc.getHeight()) bottomEdgeDef.type BodyType.STATIC bottomEdgeFixtureDef.restitution .6f bottomEdgeFixtureDef.density 0f bottomEdgeBody world.createBody(bottomEdgeDef) bottomEdgeBody.createFixture(bottomEdgeFixtureDef) ball new Image("src main resources bball.png") float shapeToImageFactor ball.getWidth() circleShape.m radius ball ball.getScaledCopy(1 shapeToImageFactor) circleBody.setUserData(ball) Override public void render(GameContainer gc, StateBasedGame sbh, Graphics g) throws SlickException Vec2 ballBodyPos circleBody.getPosition() ball.draw(ballBodyPos.x, ballBodyPos.y) Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException world.step(delta, 10, 10) ball.setRotation((float)Math.toDegrees(circleBody.getAngle())) System.out.println(world.getBodyCount()) if (world.getContactCount() gt 0) System.out.println("thank god, something hit another thing") Also, the commented out bottomEdgeBody.createFixture(bottomeEdgeFixtureDef) throws a NullPointerException, and I have no idea why. Could this be related to the body not being created properly? The world body count is at 2 as I think it should be. I was also thinking that when setting the vector's Y position at my screen height, it's actually getting set at screen height meters rather than pixels. Am I overlooking something obvious?


Client side physics simulation I am trying to create a very simple client server based physics game, using box2d library. A simple football game. Obviously, the server runs only the box2d world. My question is is it correct to state that the client should run not only the needed rendered simulation but another box2d world as well? I ask this because I know that the client should receive state information of the elements that have a changing state. And this information is received in packets every few ticks. And between every packet received, there's a time gap where I need to run the world like "nobody did nothing", and then correct the world state if somebody did something after I received the next packet. That is why I need to run the box2d world in the client as well, but I feel it's kinda awkward and assymetrical. Is this right? Is box2d prepared for this?


Libgdx explain steps for beginner to create and use image as a box2d body I am basically from corona background and new to LibGdx , familiar with stage and actor from scene2D. Now wants to use physics body from box2d in the game besides using actor from scene2D. But I need to use images in the game as body... not shapes.. anyone please explain me the steps to use images as a body. Thanks..


Why might a body suddenly stop while moving on continue platform? I have a 32x32 sprite and I make some to be platform like this for (int i 0 i lt 15 i ) attachChild(new Ground(32 i, 200, regPlatform, vertexBufferObjectManager, physicsWorld)) And I have another sprite (32x32 also) moving over those platforms (A player object) attachChild(new Player(10, 10, regPlayer, vertexBufferObjectManager, physicsWorld)) And the physicsWorld connects the player like this (Where move 1 when user click right button, and move 2 when user click left button) physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false) if (move 1) body.setLinearVelocity(new Vector2(8, body.getLinearVelocity().y)) else if (move 2) body.setLinearVelocity(new Vector2( 8, body.getLinearVelocity().y)) The Player moves smoothly form left to right and reverse. But sometimes, it is blocked. If the player move back a bit, and back again where it is blocked, it isn't blocked any more at the same place. Anyone has any idea to fix this? Maybe it is a bug of andengine and box2d and I need some trick here? Please help me. (The two sprites above are just normal png with 32x32px) Player image Platform image


How reimport a package in UDK with command line? sometimes ago, I saw a command to re import a UDK package content without opening the UDK Editor. (Especially, it was used for reimporting a Flash package in a scaleform tutorial, but it doesn't matter now ) It's very useful, because every time I change my .swf file, I should open the heavy UDK and just press re import. So, can anyone give me that solution again ?


How are the Unreal Development Kit (UDK) and Unreal Engine 4 (UE4) related? I'm thinking of learning Unreal Engine 4, but it costs money, and I want to try and keep costs as low as possible while I'm learning. In contrast, the Unreal Development Kit is free. How similar are the two? If I learn UDK first, how easily can I transition to UE4?


Unrealscript splitting a string Note, this is repost from stackoverflow I have only just discovered this site ) I need to split a string in Unrealscript, in the same way that Java's split function works. For instance return the string "foo" as an array of char. I have tried to use the SplitString function array SplitString( string Source, optional string Delimiter ",", optional bool bCullEmpty ) Wrapper for splitting a string into an array of strings using a single expression. as found at http udn.epicgames.com Three UnrealScriptFunctions.html but it returns the entire String. simulated function wordDraw() local String inputString inputString "trolls" local string whatwillitbe local int b local int x local array lt String gt letterArray letterArray SplitString(inputString,, false) for (x 0 x lt letterArray.Length x ) whatwillitbe letterArray x log('it will be ' whatwillitbe) b letterarray.Length log('letterarray length is ' b) log('letter number ' x) Output is b returns 1 whatwillitbe returns trolls However I would like b to return 6 and whatwillitbe to return each character individually. I have had a few answers proposed, however, I would still like to properly understand how the SplitString function works. For instance, if the Delimiter parameter is optional, what does the function use as a delimiter by default?


Optimizing UV Map Sheet Based On Surface Area? I am trying to get my UV Map Sheets Optimized Based On Surface Area , I need Them optimized cause my scene area is huge and i want to use them in UDK so i am trying to get maximum possible optimization and i am running out of time Here is What i Try TO Achieve Default 3DS Max Optimized By HAND THIS IS WHAT I WANT Or Even Better If There Is Automated Intelligence Tool Also I know this Tools Flatiron , UVPacker But They Are No Use


How should I set up UDK with Git and CruiseControl? For a new project in UDK, I'd like to set up a Git repository for version control and a CruiseControl.NET based continuous integration solution. The good news is that he first part seems easy enough and CruiseControl.NET can work off Git repositories. The bad news is that according to my searches, nobody has ever tried to do this. Ideally, I'm looking for a step by step guide on how to set up such a development environment assuming more than one development computer, one central repository for the "master" branch, and one machine for building and packaging the binaries via CruiseControl.NET. Related Version control system for game development with UDK? Options for UDK and version control repositories? CruiseControl.NET and Git


How to add melee weapons in UDK? I am very new to game design and programming in Unrealscript for UDK. I have created a weapon mesh and imported it alongside it's animation set and created a start and end socket on it. I was wondering if anyone could help me create a weapon class for it and allow it to be used in the game?


Push and damage player pawn when hit by rotating pawn? (UDK) I'm working on a game in which the player runs around a level themed as a pinball machine. There are flippers that react to the presence of pinballs by flipping (as one would expect pinball flippers to do). The problem that I'm having is that if the player is in the path of the flipper as it rotates, the player is instantly killed. The desired behavior is that the player is damaged and pushed away from the moving flipper. I've tried all sorts of things to make this stop happening. Currently, in the flipper, I have the following code to handle the collision event Bump(Actor other, PrimitiveComponent otherComp, Object.Vector hitNormal) local vector pushVelocity if( If Flipper is moving and is bump()ing the Player ) pushVelocity hitNormal CalcLinearVelocity(vsize(location other.location)) player.TakeDamage(playerDamage, none, player.Location, pushVelocity 2.1f, class'DamageType', , self) By using all sorts of logging, I can determine that the code in question is being called when the flipper hits the player and the player is being killed on the first frame this collision occurs logging within the if() block only appears once. And yes, playerDamage is a value low enough that it would take many hits to kill the player. Does anyone have any insight as to why the player is immediately dying instead of being damaged and pushed away? Or what sorts of things I should try to get my intended behavior?


SetBase with a KActor descendant does not appear to function I have a KActor descendant, which is a carging shot, kind of like in R Type. When it starts charging, I do projectile.SetBase(Pawn) in the PlayerController where it is spawned. I've checked in the debugger, and its base is in face the pawn. But it does not move with the pawn. I have done this before, where I base KActors on a moving entity, and it moved with them. I must have done something differently, but I can't figure out what it was. Looking at the old code, I just did SetBase like I am now. Any ideas where I might be going wrong?


UDK Checking actor type in projectile ProcessTouch So, to be brief, I'm trying to teleport a pawn when it's struck by a projectile (or damaged by any weapon in my game.) Right now, I'm trying to just call Pawn.SetLocation in the projectile's ProcessTouch. That's a problem because ProcessTouch will hit any actor, not just a pawn. Additionally, any attempts to check the ProcessTouch's "Actor Other" throws errors. I've tried a bunch of solutions (including making a event TakeDamage in the Pawn controller class,) but to no avail. simulated function ProcessTouch(Actor Other, Vector HitLocation, Vector HitNormal) if (Other ! Instigator) This is where the Other.TakeDamage goes if we are using a traditional gun. if (Other Pawn) Other.SetLocation(0,0,0) Destroy This code complains that Pawn's a bad expression. How else should I check actor type here?


Get Final output from UDK ( sorry for my bad english in advance D ) I'm trying to get a .exe setup output, from my UDK !( with my own maps and scripts which I made within MyGame) I tried UnrealFrontEnd! But It made a setup , that after installation I can see my .udk maps, my packages and etc. But It's not a real output that I can show to my customers. I don't want, other can use my resources ! So... How can I get a binary like output from UDK as a real Game Output ? ( like what we see in all commercial games ) Is there any option in frontend that I missed ?


UnrealEngine how to create pirate boat tutorial I fount an Unity tutorial how to crate pirate boat, but I still can't find any sources (links, videos) how to create it using UE. Kind of this. So when you use character controller it can jump, run and etc, but with a boat you should smoothly running trough the waves with some bouncing effects. So I try to find tutorial that describe how to create this pirate boat. So the question not about model, so I can even use a cube that I can move through waves.


How to factorize code in Unreal Kismet (i.e. "Material Function"s for Kismet) In the Unreal Development Kit, when using the Material Editor, one can factorize frequently used groups of nodes by creating a Material Function (content Browser right click new matrial function, IIRC). When defining the behaviour of some actor in Kismet, one can easily have a dozen nodes involved. If I have many actors that share the same behaviour, then I'll copy paste these nodes, and change the variables so they point to the other actors. This leads to inconsistencies (a modification in the behaviour of an actor isn't propagated in the copy pasted nodes), complexity (you end up with hundreds of nodes), and generally useless effort. My question is Can I create a "kismet function", just like a material function ? Note I'd rather avoid using UnrealScript. I don't even know where to type UnrealScripts, don't know where the documentation is and more generally don't have enough time to invest in learning UnrealScript. This "kismet function" feature must be usable by graphists (with little programming knowledge). If a (simple) script suffices to add this feature in the Kismet editor, so that one can create several "functions" without using UnrealScript, then fine, but I don't really want to have to write a script each time I want to factorize a few nodes. Thanks for any information !


Why might a Projectile hitting a KActor only call HitWall, and not ProcessTouch? I have a Projectile subclass that seems to work fine. It travels, does Explode(), etc. But when it hits one of our KActors, I get a HitWall event but not a ProcessTouch event. So my question is, why would a colliding actor trigger HitWall, but not ProcessTouch?


differences in UDK map on different installs My goal is to create a simple groundplane in UDK (11 2012 version, fresh install) that the user will be able to run around on. My requirements are therefore very basic and I tried to whip something up quickly in the editor. I created a circular (cylinder) plane and applied a material. I added a Blocking Volume, a Lightmass Importance Volume, and a Sky Light. I built everything and get no errors. The map played fine on my system. I transferred the file to another system with the same version of UDK (also a recent install). When I try to play the map, I plunge to my death. Though I have verified that my player start position is above the ground, I seem to start below the ground looking up at it. What could cause a map that works great on one system have such a positioning issue on another system? I believe this is a valid question. I'm obviously going to need to systematically test things and I already have tried moving the player start etc. However, I will need to have some idea of what can differ between installs. I'm extremely new to the UDK. Thanks.


Import FBX with multiple meshes into UDK I used this script to generate a few buildings that I was hoping to import into UDK. Each building is made of about 1000 separate objects. When I export a building as FBX and import the file into UDK it breaks it up into its individual objects again, so I was wondering how I would avoid this. Whether there was a tool to combine all of the objects into one mesh automatically before exporting or if I could prevent UDK from breaking them upon import.


3D Game Engine comparable to UDK that's not GPL'd Are there any good, free 3D game engines similar to UDK that are under open source licenses without copyleft provisions?


Hidden Loading with UDK I was wondering, how would I go about creating hidden loading scenes with UDK? For example, a character walks in to an elevator, the elevator fakes movement, whilst the previous floor is destroyed and the next floor is loaded on top. I assume it's possible with UDK, since it's supposedly rather flexible, but I've never used UDK before (I decided to ask this question first to save me learning it all, finding out it isn't possible, then giving up). So yeah, is hiding the loading process possible? And if so, how would I go about doing it?


How do I make game server for UDK game? I'm new in UDK and I'm starting to develop online multiplayer games. There is a one problem, I couldn't find any tutorials about how to make a game server using udk. I suppose, that it uses unreal script. But that's about all I know about it. So I'd really like for some help.


Changing State in PlayerControler from PlayerInput In my player input I wanna change the the "State" of my player controller but I have some trouble to do it my player input is declared like that class ResistancePlayerInput extends PlayerInput within ResistancePlayerController config(ResistancePlayerInput) and in my playerControler I have that class ResistancePlayerController extends GamePlayerController var name PreviousState DefaultProperties CameraClass class 'ResistanceCamera' Telling the player controller to use your custom camera script InputClass class'ResistanceGame.ResistancePlayerInput' DefaultFOV 90.f Telling the player controller what the default field of view (FOV) should be simulated event PostBeginPlay() Super.PostBeginPlay() auto state Walking event BeginState(name PreviousStateName) Pawn.GroundSpeed 200 log("Player Walking") state Running extends Walking event BeginState(name PreviousStateName) Pawn.GroundSpeed 350 log("Player Running") state Sprinting extends Walking event BeginState(name PreviousStateName) Pawn.GroundSpeed 800 log("Player Sprinting") I have tried to use PCOwner.GotoState() and ResistancePlayerController(PCOwner).GotoState() but won't work. I have also tried a simple GotoState, and nothing happen how can I call GotoState for the PC Class from my player input ?


UDK Problem with Touching Actors In my game I am trying to see all touching actors of a particular DynamicSMActor and it does return only two Actors as touching Actors Water Volume and Player Pawn. It is ignoring all the other DynamicSMActors that are touching. I actually tried different values for collision type, Blocking type, etc,. No success. Any help is really appreciated.


Unreal Engine Scaleform How do I capture a button click event? I'm new to Unreal Development. In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?


How do I create an actor class in UDK that will spawn a specific particle system? I'm trying to write a new class that I can drag from actor classes window into the scene and it will spawn a specific particle effect. Its going to be a 'prop' that later will also contain a static mesh and a point light. Maybe some defined variables that can be changed in the properties window. So far, I have the static mesh working using this code class LightFixture extends StaticMeshActor defaultproperties Begin Object Class StaticMeshComponent Name myMesh bAllowApproximateOcclusion TRUE bForceDirectLightMap TRUE bUsePrecomputedShadows TRUE StaticMesh StaticMesh'props.Meshes.lamp' End Object Components.Add(myMesh) now, I'd like to add a particle system (template?), and from what I'm learning, it's not as easy as adding the mesh. In a new class, I tried to add a particle effect this way class FireParticle extends EmitterPool placeable var ParticleSystemComponent PSC defaultproperties Begin Object Class ParticleSystemComponent Name myEffect bAutoActivate true Template ParticleSystem'props.FX.fire' End Object ParticleSystemComponent myEffect Components.Add(myEffect) So that didn't work... I read somewhere that emitterpool was the way to spawn.. I am very new to scripting, if that isn't already obvious ) thanks in advance, if anyone can help..


How do I avoid Race Conditions in UnrealScript? I'm trying to create a pseudo turn based battle system in the Unreal Engine (think Final Fantasy style). I'm trying to avoid the Enemies and the players attacking while another animation is in progress. I thought the most simple solution is to have a flag somewhere that the player controllers check before starting an animation, and set it to a value before they start, and then reset it when they've finished. However, I could see this leading to race conditions if two controllers (AI or player) try to access the variable at the same time, then both start their animations. If I was writing this in Java I'd obviously use synchronized methods, but I haven't come across anything like that in UnrealScript. Is there another way to avoid this? Its probably not the end of the world, as its a pretty unlikely occurance, but I'd like to try and avoid it completely if possible.


How should I set up UDK with Git and CruiseControl? For a new project in UDK, I'd like to set up a Git repository for version control and a CruiseControl.NET based continuous integration solution. The good news is that he first part seems easy enough and CruiseControl.NET can work off Git repositories. The bad news is that according to my searches, nobody has ever tried to do this. Ideally, I'm looking for a step by step guide on how to set up such a development environment assuming more than one development computer, one central repository for the "master" branch, and one machine for building and packaging the binaries via CruiseControl.NET. Related Version control system for game development with UDK? Options for UDK and version control repositories? CruiseControl.NET and Git


What exactly is the difference between Unreal Development Kit and Uunreal Engine 4? I want to start learning game development and I would obviously come across this tool. So every where I went people mentioned Unreal Engine 4 to be a viable choice, I've tried a bit of Unity and now I want to try Unreal. Only issue I came across UDK and UE4, I downloaded UDK which turns out to be different from tutorials and I can't seem to find any info on that and besides I could only run the software once because after the first time it starts a game, I re installed UDK I still get the issue, but anyways that's a different topic, what I want to know is whether UDK and UE4 are different and if they are, where do i get UE4, becauuse when I down UE4 (from https www.unrealengine.com dashboard), it downloads a game launcher and no development tool. In case they are same, why is my version of UDK different fr


Transfer my UDK 2 project to UDK 3? Is it possible to export my UDK 2 project to UDK 3 ? What kinds of things aren't transferable?


Valve Source Engine UDK and CUDA Do any games use the GPU for more game tasks than just rendering, as a way to reduce the game's load on the CPU? I'm most interested in games which use either Valve's Source engine or the UDK. Is it possible effective to even do such a thing?


Push and damage player pawn when hit by rotating pawn? (UDK) I'm working on a game in which the player runs around a level themed as a pinball machine. There are flippers that react to the presence of pinballs by flipping (as one would expect pinball flippers to do). The problem that I'm having is that if the player is in the path of the flipper as it rotates, the player is instantly killed. The desired behavior is that the player is damaged and pushed away from the moving flipper. I've tried all sorts of things to make this stop happening. Currently, in the flipper, I have the following code to handle the collision event Bump(Actor other, PrimitiveComponent otherComp, Object.Vector hitNormal) local vector pushVelocity if( If Flipper is moving and is bump()ing the Player ) pushVelocity hitNormal CalcLinearVelocity(vsize(location other.location)) player.TakeDamage(playerDamage, none, player.Location, pushVelocity 2.1f, class'DamageType', , self) By using all sorts of logging, I can determine that the code in question is being called when the flipper hits the player and the player is being killed on the first frame this collision occurs logging within the if() block only appears once. And yes, playerDamage is a value low enough that it would take many hits to kill the player. Does anyone have any insight as to why the player is immediately dying instead of being damaged and pushed away? Or what sorts of things I should try to get my intended behavior?


How do you set event after a pawn takes damage? How can I set event after bot pawn takes damage in UDK? (possibly in Kismet?) I need to do something similar to this http www.youtube.com watch?v gjRf5lTcWLY


Using Canvas instead of Scaleform in UDK I'm working with Unreal Script, and I need to use Canvas instead of Scaleform to create a HUD. I've extended the game type from UTGame, and used bUseClassicHUD in the Default Properties section, but the default Scaleform HUD continues to appear. I know for certain that I have everything configured properly to load and run the scripts, but this one line just doesn't seem to have any effect. DefaultProperties Disable the scaleform (flash) HUD in the UTGame bUseClassicHUD true Initial score value nScore 0 Initial time value m gameTimer 30.0 Is there something else I need to include? I've done a reinstall (I'm using the July 2013 build), but to no avail.


Does Unreal Engine Has Good grapic texture editor or I have to Learn Maya? I'm new in game Development , and I had no experience of it (except programming) So , for my Engine , I preferred to use Unreal Engine. So here's the question Are Maya or 3D'sMax needed to be learned or Unreal Engine has a built in Editor ? and , in comment , After i learned graphic , witch programming Language Does Unreal Engine support and recommended ?


UDK Packaging the Game I have set up all the config files to my game classes and am able to launch the game to test everything. Although when I package the game, it still runs the UT deathmatch game?? What other lines in the config files should be changed to make it default to my game and default map once published?


How can I disable the green frames after a cinematic in UDK? These green frames appear in my scene after the display of a cinematic (which I just added recently) How can I remove them, ideally without resorting to transitioning the game mode?


UDK Toggle Material on Brushes? I'm attempting to change toggle the material that's applied to a BSP brush. I've seen where it's possible on static meshes, but I can't seem to get it to work on brushes. Below is an example scenario. The ground (BSP Brush) is covered in a stone material The player hits a trigger. A new "moss" material is applied to the brush, removing the old stone material. Any assistance you could offer would be greatly appreciated.


UnrealScript access variable in one class from another? So there are some similar questions out there but the responses often say that you should use 'new' or 'spawn', but I'm working with the playercontroller don't want to make a new playercontroller. Maybe this isn't the right way to be doing this but I want to view the state of a variable in the playercontroller that will change fairly often from my HUD. Is there a way to do this? playercontroller class var bool bYeaNo exec function change() bYeaNo !bYeaNo defaultproperties bYeaNo false HUD class event PostRender() Super.PostRender() function DrawHUD() Super.DrawHUD() Canvas.SetDrawColor(0, 0, 0) Canvas.SetPos(25, 25) if (bYeaNo) this is wrong so what would make this work? Canvas.DrawText("Yea") else Canvas.DrawText("No")


How to detect the device type in UnrealScript? How can I recognize if the player device is an iPad or an iPhone? Now I can do it by checking the viewport size. But I think is just a tricky way, is there any other, more standard way?


Deleting Objects Before Export from Maya Causes .PSK to Crash UDK on Import I'm using Maya 2008 Complete and 03 11 build of UDK as well as 07 10 build (haven't got around to installing newer version on other computer). I am using ActorX to export. I have a character that I have rigged and animated (I'm not using UDK rigs). Here was my process Early on in the process, I had other objects skinned to the character's skeleton. I hid those objects while weighting the character I decided later that I wanted to delete them. I tested my .psk in both UDK builds with those objects hidden and noticed that they still showed up (in UDK) So, I went back into Maya, detached the skin on those objects and deleted history, then deleted them. I then re exported my .psk and now when I try and import, udk crashes. Here are my input output connections for one of the objects before detaching the skin. http i.stack.imgur.com hoDdv.jpg Here is my log 0002.77 Log gt gt gt gt gt gt gt gt gt gt gt gt gt gt Initial startup 2.77s lt lt lt lt lt lt lt lt lt lt lt lt lt lt lt 0002.81 Cmd MODE MAPEXT udk 0002.87 SourceControl Source Control disabled in GAMEEditorUserSettings.ini. SourceControl has Disabled False 0005.61 Log TIMER ALL OF INIT 5.028131 0070.42 Log FactoryCreateBinary SkeletalMesh with SkeletalMeshFactory (0 0 Z websterProject2 EXPORTTESTING SK snailMesh01.PSK) 0070.42 Log Skeletal skin VPoints 812 0070.42 Log Skeletal skin VVertices 1166 0070.42 Log Skeletal skin VTriangles 1596 0070.42 Log Skeletal skin VMaterials 1 0070.42 Log Skeletal skin VBones 73 0070.42 Log Skeletal skin VRawBoneInfluences 1520 0070.42 Log Skeletal skin VertexColors 0 0070.42 Log Skeletal skin Num Tex Coords 1 0070.42 Log Mesh material not found among currently loaded ones lambert3SG 0070.42 Log Bones digested 73 Depth of hierarchy 15 0070.49 Critical appError called Assertion failed Wedges.Num() WedgeInfluenceIndices.Num() File c depot UnrealEngine3 Development Src Engine Src UnSkeletalTools.cpp Line 301 Stack Address 0x402228f9 (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x40924bb1 (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x412bfbc8 (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x401a178d (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x412964a4 (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x412823a4 (filename not found) in C UDK UDK 2010 07 Binaries Win64 UDK.exe Address 0x983633 (filename not found) in C UDK UDK 2010 07 Binaries Win64 wxmsw28u vc custom 64.dll Address 0x983d73 (filename not found) in C UDK UDK 2010 07 Binaries Win64 wxmsw28u vc custom 64.dll Address 0x983e30 (filename not found) in C UDK UDK 2010 07 Binaries Win64 wxmsw28u vc custom 64.dll Address 0x800a34c6 (filename not found) in C UDK UDK 2010 07 Binaries Win64 wxmsw28u core vc custom 64.dll Address 0x800aec65 (filename not found) in C I would like to know why deleting these objects is causing the .psk to crash on import and how I can fix it. Thanks very much for your time.


Hidden Loading with UDK I was wondering, how would I go about creating hidden loading scenes with UDK? For example, a character walks in to an elevator, the elevator fakes movement, whilst the previous floor is destroyed and the next floor is loaded on top. I assume it's possible with UDK, since it's supposedly rather flexible, but I've never used UDK before (I decided to ask this question first to save me learning it all, finding out it isn't possible, then giving up). So yeah, is hiding the loading process possible? And if so, how would I go about doing it?


Options for UDK and version control repositories? Another developer and I have begun to experiment with the Unreal Development Kit and have installed the UDK to our local computers. He's been toying around and experimenting and has some basic code and assets already developed. We want to set up a VCS repository so we can collaborate on development of a UDK project. Some things we've noticed Source code goes in Development Src GameName . Binary Content and other assets go in UDKGame . The rest of the folders in the root directory are for the core UDK installation. In terms of repositories, we've already come up with several options Commit everything (even the core UDK code). Pro Easy Con We're committing lots of code that, while a dependency of our project, isn't technically part of the project. Commit the two folders we contribute to in two separate repositories. Pro Isolates versioned code to stuff we create. Con Slightly more difficult to set up, commits for one fix span multiple repositories, and we're committing a lot of binary content. Change the config so both the src and the assets live in one folder, then commit that. Pro Isolates versioned code, commits for changes are in one repo. Con Committing binary content. Commit SRC to one repo, use another solution for assets (FTP, Dropbox, etc) Pro Isolates versioned code, no extra overhead in versioning binary content. Con Changes span multiple places and manual updates to a remote storage solution are needed. As we assess the best way to go about this so we don't back ourselves into a corner later, I'm wondering if there are other options and what their pros and cons are. I realize we could easily just pick a solution and change it up once we ran into scaling issues, but version control has always been one of those things I like to do once upfront and then forget about when I work on projects.


Unreal Engine Scaleform How do I capture a button click event? I'm new to Unreal Development. In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?


How do I make game server for UDK game? I'm new in UDK and I'm starting to develop online multiplayer games. There is a one problem, I couldn't find any tutorials about how to make a game server using udk. I suppose, that it uses unreal script. But that's about all I know about it. So I'd really like for some help.


UDK license (DLLBind) I dont understand part of UDK's license about DLLBind does it allow to use DLLBind in UDK projects? Could I use DLLBind for commercial games without buying c native license?


Unity 5 Camera Functions Usage Error How to use functions like ScreenToRayPoint() in Camera class? I have used this code Ray ray camera.ScreenPointToRay(Input.mousePosition) and it says Component.camera is obsolete, instead using GetComponent() Then I tried these Camera cam GetComponent lt Camera gt () Ray ray cam.ScreenToRayPoint(Input.mousePosition) and it says Camera doesn't contain a definition of ScreenPointToRay and no extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found.


Camera (pole cam) implementation problem In my project I have simple scene graph to render whole scene and Bullet physics SDK to provide physics simulation. Each rendered object is represented as scene node. Camera always has target and located behind this target. Target can be any scene node. First, I want to describe my rendering pipeline. 1)When time to render whole scene, we calculate view matrix from target's world matrix. We take offset vector in order to locate camera behind targeted scene node and transform it to scene node world's coordinate. Then add position of target with transformed offset vector. Finally, get inverse matrix of scene node. This method always is called before rendering whole scene. HRESULT CameraNode SetViewTransform(Scene pScene) If there is a target, make sure the camera is rigidly attached right behind the target if(m pTarget) Mat4x4 mat m pTarget gt VGet() gt ToWorld() Vec4 at m CamOffsetVector Vec4 atWorld mat.Xform(at) Vec3 pos mat.GetPosition() Vec3(at) mat.SetPosition(pos) VSetTransform( amp mat) Set normal matrix and calculate inverse matrix m View VGet() gt FromWorld() Get inversed matrix pScene gt GetRenderer() gt VSetViewTransform( amp m View) return S OK 2)Then, when time to render particular scene node, we calculate projection matrix and send it to the vertex shader. Mat4x4 CameraNode GetWorldViewProjection(Scene pScene) Mat4x4 world pScene gt GetTopMatrix() Mat4x4 view VGet() gt FromWorld() Mat4x4 worldView world view return m Projection worldView I have next problem, when I calculate view matrix from target's world matrix and locate target on coordinate ( x 0 y 10 z 1) it started to fall due to physics and jerk twitch. 1 When I set view camera matrix only offset position. Scene node falls without jerking twitching. 2 How I can fix this jerking twitching when camera is following the scene node ? I suppose that it is problem of matrices multiplication, when Bullet SDK sets new coordinates to scene node. But I have no idea how it can be solved.


Min. Distance for Spotlights in Ogre3d? I have a simple scene with only one empty box. Within that box I have the camera attached to a scene node, which the user can move (translate rotate). Additionally a spotlight is attached to the camera's scene node, facing into the same direction as the camera. So when the camera is moved, then the light moves as well. m pCamera m pSceneMgr gt createCamera("Camera") m pCamera gt setNearClipDistance(0.01) m pCamNode gt attachObject(m pCamera) Light spotLight m pSceneMgr gt createLight("spotLight") spotLight gt setType(Light LT SPOTLIGHT) spotLight gt setDiffuseColour(1, 1, 1) spotLight gt setSpecularColour(1, 1, 1) spotLight gt setSpotlightRange(Degree(50), Degree(100)) spotLight gt setSpotlightNearClipDistance(0) spotLight gt setDirection(m pCamera gt getDirection()) m pCamNode gt attachObject(spotLight) So, this basically works fine. There is one problem though As soon as the user moves the camera very close to a side of the box, then suddenly all is black, I can't see anyting. I am sure the camera is NOT moving through the box's side, it is still within the box. So the problem seems to be that the light does not "work" when it is too close to an object, as if the object (the box side in my case) is not reflecting the light any more. Any ideas?


Swapping Y and Z causes problems with Camera I am trying to swap the Y and Z axis in my program. Everything worked great when Y used to be the axis coming out of the plane. After having swapped y and x, I have been able to draw my terrain using the X Y as the plane and Z as the height, however when converting the code for the camera I am running into trouble. Here is the code that gives me the correct camera (so y is the axis coming out of the plane), along with an illustration. The code is in SharpDX which is a C wrapper for DirectX Setup the position of the camera in the world. Vector3 position new Vector3(PositionX, PositionY, PositionZ) Setup where the camera is looking forwardby default. Vector3 lookAt new Vector3(0, 0, 1.0f) Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians. float pitch RotationX 0.0174532925f float yaw RotationY 0.0174532925f float roll RotationZ 0.0174532925f Create the rotation matrix from the yaw, pitch, and roll values. Matrix rotationMatrix Matrix.RotationYawPitchRoll(yaw, pitch, roll) Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin. lookAt Vector3.TransformCoordinate(lookAt, rotationMatrix) Vector3 up Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix) Translate the rotated camera position to the location of the viewer. lookAt position lookAt Finally create the view matrix from the three updated vectors. ViewMatrix Matrix.LookAtLH(position, lookAt, up) Here is an illustration of what this produces, I am able to successfully move the camera around with the mouse by having the mouse differences affect the x and y rotation Now if I swap all the X and Y in my terrain, without affecting the camera, I get this So now the camera is facing the terrain directly, and attempts to yaw will not produce the desired view. (the world will revolve around the camera when looking perpendicular to the terrain, and spin in place when looking at the horizon, the exact opposite of what we want.) Now I thought that maybe if I just change the lookAt to 0, 1.0f, 0 swap the y and z rotations, and change the Up vector to use Vector3.UnitZ, it would solve all my problems. Setup the position of the camera in the world. Vector3 position new Vector3(PositionX, PositionY, PositionZ) Setup where the camera is looking forwardby default. Vector3 lookAt new Vector3(0, 1.0f, 0) Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians. float pitch RotationX 0.0174532925f float yaw RotationZ 0.0174532925f float roll RotationY 0.0174532925f Create the rotation matrix from the yaw, pitch, and roll values. Matrix rotationMatrix Matrix.RotationYawPitchRoll(yaw, pitch, roll) Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin. lookAt Vector3.TransformCoordinate(lookAt, rotationMatrix) Vector3 up Vector3.TransformCoordinate(Vector3.UnitZ, rotationMatrix) Translate the rotated camera position to the location of the viewer. lookAt position lookAt Finally create the view matrix from the three updated vectors. ViewMatrix Matrix.LookAtLH(position, lookAt, up) However, doing this, I get the same issue as before, the world will revolve around when looking perpendicular to the ground, but spin in place when looking parallel to the ground (so towards the horizon). I believe the camera now looks like this Which doesn't make sense to me, since I thought changing the Up vector to UnitZ would make Z face up and not parallel to the ground. Any suggestions to change the second code block is appreciated.


Camera view projection issue I made a simple OpenGL program but I can figure out why the camera is not working, here it's a little fragment of the Camera class public Matrix4f getView() initializes the view matrix return new Matrix4f().lookAt( new Vector3f(0f, 0f, 1f), camera position at 0,0,1 new Vector3f(0f, 0f, 0f), camera target at 0,0,0 new Vector3f(0f, 1f, 0f)) up axis set to "worldUp" (0,1,0) public Matrix4f getProjection() return new Matrix4f().perspective( (float) Math.toRadians(fieldOfView), the fov has a value between 0f and 180f, by default I set it to 90 viewportAspectRatio, the aspect ratio is equal to 1024 960 (screen height screen width)... even if I've not understood what is it... 0.1f, 1000f) I've not really understood what near and far planes are... public Matrix4f getMatrix() with this function I obtain the final camera matrix return getView().mul(getProjection()) And it's how I handle the camera Matrix in GLSL, created using camera.getMatrix() gl Position camera model vec4(position, 1.0) Without the camera all is fine here's the program running using gl Position model vec4(position, 1.0) (Yeah, it's a cube) But using the camera in the way I showed you before, increasing the FOV, I get this Could anyone look at my code and tell me where I'm wrong? I would be really happy... D


Unreal Engine custom camera I was looking at game engines and found Unreal Engine. I want to make a game where the player has to create a camera by crafting it and can customize how many pixels the camera detects and what the camera detects (Ex Sound, light, energy, etc). How could I do this?


Moving camera along generated terrain? I'm generating my terrain on the GPU, using diamond square subdivision (no height map involved). How can I anchor the camera's position to always be on top of the generated terrain? Thanks


Smooth Camera Offsets I am attempting to implement a sort of, smooth camera that has angle offsets from the player as they turn, creating a cinematic effect as well as visual feedback for when the player turns. Here is an example of the desired functionality. (Starts at 1 06) http youtu.be uJ6tD k RuA?t 1m6s One idea I was thinking of (if even feasible) is to store a "desired quaternion" of orientation of where the camera wants to look (preferably the player's quaternion of orientation) and a "current quaternion" of the cameras orientation and SLERP to the desired quaternion. Then possibly set a max angle between the two rotations to cap how large the angle offset could be. What are the ways of doing that?


What does it mean to "strafe" the camera? I'm looking at a tutorial in which both the terms camera moving and "strafing" are used. I looked onto dictionary.com and found strafe verb (used with object) 1. to attack (ground troops or installations) by airplanes with machine gun fire. 2. Slang . to reprimand viciously. noun 3. a strafing attack. WTF??? I'm not a native english speaker.


Isometric character from 3D blender model I am trying to make a character for an isometric game from a 3D model in Blender. I managed to create a simple humanoid model and implement an isometric camera, rotated by 60 on the x axis and 45 on the z axis. Following a screenshot of this model with camera settings I chose making a 3D model in blender because I want to be able to make changes to my models without having to change loads of images or sprite sheets and I also wanted to get into 3D modelling. I looked into articles by clint bellanger that's where I got the idea to make my graphics in blender, rather than draw in Illustrator or photshop but I am not sure how I should continue now. My questions are is this a good way to accomplish my goal of making an isometric character from a 3d model if it is feasible to turn around the ratio of 2 1 between width and height for my character or if I should render it another way if the settings of the camera I have in blender are correct to use for an isometric game with a 2 1 ratio of width and height for the tiles. Thanks in advance


Pygame Scrolling Map I have two questions. I'm working in a rogue like and I've manage to implement a camera on the player, the camera shows just the players surroundings and is fixed in the side of the windows. The problem is, when the player is close to the sides of the map there's a black space in the surface. Like so 1) How do I make the camera 'snap' to the side and don't go any further? To draw the map I took the Camera Rect positions topleft and bottomright Converted it to World Position Iterate over it, with a enumerator too Did any lit visited FOG calcunations with X and Y And Blited in the screen using the enumerators 'i' and 'j'. Here's the code topleft Map.toWorld(camera.rect.topleft) bottomright Map.toWorld(camera.rect.bottomright) for i, x in enumerate(xrange(topleft 0 , bottomright 0 )) for j, y in enumerate(xrange(topleft 1 , bottomright 1 )) tile mymap.tileAt(x, y) object obj for obj in Object.OBJECTS if obj.pos (x,y) if tile lit field of view.lit(x, y) visited field of view.visited(x, y) graphic tile.graphic if lit color tile.color elif visited color GRAY else color BLACK renderedgraphic myfont.render(ch, 1, graphic) screen.blit(renderedgraphic, Map.toScreen((i 1, j))) if object Draw.drawObject(object 0 , Map.toScreen((i 1, j))) I saw HERE a exemple of this but I couldn't adapt the code to my game because it uses sprites. I also tried a different approach using just a camera.center position in short class Object() def update(self) self.relX self.x camera.x self.relY self.y camera.y class Camera(Object) def update(self) self.x self.relX PLAYER.x self.y self.relY PLAYER.y def MapDraw() for x in xrange(mymap.width) for y in xrange(mymap.height) ... do fov stuff tile Tile.At(x, y) get tile instance if tile tile.update() update it's relative position screen.blit(renderedgraphic, (tile.relX TILESIZE, tile.relX TILESIZE)) blit the postion to it's relative position This is what happens which leads to the next question 2) Is there a better way to create a camera than using this 'hack' of enumerating? EDIT Answer So after some struggles I tried the old, print whatever I had and found out that I could use the camera.x and camera.y for this. first I check the distace between camera.x and the optional position in the sides, It was 3 for up and down, 7 to sides. Then a couple of if statements fixed this. But since int's aren't very consitent depending on mapsize, cameraview, I found that the camera.rect width and height divided by 2 in world position was the same as (7,3) I was looking for. Anyway, here's the code for the camera. def update(self) self.x, self.y PLAYER.pos center camera on player self.size Map.toWorld((camera.rect.width, camera.rect.height)) get the ScreenSize of the rect and convert to World Position self.size 0 2 divided each one by two, because the player is in the center. self.size 1 2 if self.x lt self.size 0 right self.x self.size 0 if self.y lt self.size 1 up self.y self.size 1 if self.x self.size 0 gt mymap.width left self.x mymap.width self.size 0 if self.y self.size 1 gt mymap.height down self.y mymap.height self.size 1 self.rect pygame.Rect((self.x TILESIZE) CAMERA WIDTH 2, (self.y TILESIZE) CAMERA HEIGHT 2, CAMERA WIDTH, CAMERA HEIGHT) updated the rect Thanks Tyyppi 77, even tho you provided a small answer, the way you phrased it was just right for me to get it.


Implementing Screen Shake I'm looking to implement screen shake in a 2D top down game. From an earlier Q on this exchange, I learned that noise values could be a good candidate, so I intent to try that. But I wonder is a screen shake more about rotating the 2D topdown camera, or about jittering the position of that camera? Or does it really require both? Additionally, I would like to know if a good screenshake would require motion blur? Something like rendering your world in 4 small micro steps for each 60fps frame, maybe? Or can you shake the camera at 60fps with normal rendering and it still looks good? The quality I am after is something like shown in this video. It's kinda hard to judge, but it seems that video does translational jitter only?


Ortbit camera rotation multiplication order with quaternions? So I switched my camera to use quaternions and the first thing I noticed is that things started to 'roll' even though I'm not using any roll values. I looked it up and I found that people suggest that using rotation horizontal rotation vertical solves the issues instead of rotation rotation horizontal vertical which I thought was the more intuitive thing from doing matrix multiplication. The explanations I read as to why one works and the other doesn't were pretty vague and unclear. My question is why does it work this way? what's wrong with 'rotation h v ? Sample code float Horizontal 0 float Vertical 0 if (Keys 'W' Key Held) Camera gt Position Camera gt Forward() CamMovSpeed DeltaTime if (Keys 'S' Key Held) Camera gt Position Camera gt Forward() CamMovSpeed DeltaTime if (Keys 'A' Key Held) Camera gt Position Camera gt Right() CamMovSpeed DeltaTime if (Keys 'D' Key Held) Camera gt Position Camera gt Right() CamMovSpeed DeltaTime if (Keys 'E' Key Held) Camera gt Position vec Up CamMovSpeed DeltaTime if (Keys 'F' Key Held) Camera gt Position vec Up CamMovSpeed DeltaTime mouse int dx Mouse gt x Mouse gt LastX Mouse gt LastX Mouse gt x int dy Mouse gt LastY Mouse gt y Mouse gt LastY Mouse gt y if (Mouse gt MMB Key Held) pan Camera gt Position (Camera gt Up() dy Camera gt Right() dx) SpeedMul 2 DeltaTime if (Mouse gt RMB Key Held) orbit Horizontal dx SpeedMul 10 DeltaTime Vertical dy SpeedMul 10 DeltaTime if (Mouse gt Wheel) zoom Camera gt Position Camera gt Forward() Mouse gt Wheel SpeedMul 10 DeltaTime if (Horizontal ! 0 Vertical ! 0) quat QVertical(vec Right, Vertical) quat QHorizontal(vec Up, Horizontal) Camera gt Rotation QHorizontal Camera gt Rotation QVertical this works Camera gt Rotation Camera gt Rotation QHorizontal QVertical this doesn't Camera gt Rotation.Normalize()


Realistic Camera Screen Shake from Explosion I'd like to shake the camera around a bit during an explosion, and I've tried a few different functions for rocking it around, and nothing seems to really give that 'wow, what a bang!' type feeling that I'm looking for. I've tried some arbitrary relatively high frequency sine wave patterns with a bit of linear attenuation, as well as a square wave type pattern. I've tried moving just one axis, two, and all three (although the dolly effect was barely noticeable in that case). Does anyone know of a good camera shaking pattern?


Camera LookAt position with fixed screen position I have a perspective "lookAt type" camera. I'm trying to compute specific focus point of the camera, which should be placed in the middle of the screen I also have a custom 3d point in world space, margin values in screen space and camera's tilt as inputs. I want to compute lookAt point, amp camera distance with restriction, that input world space point has to be visible in the middle of the free screen space area (not affected by margin values) and it has to have a given tilt. I'm able to compute this in 2D, but I'm lost in 3D. Any idea how to achieve this? Here's a sketch of the problem, red and blue area's are margin values of 0.5f in both x and y direction.


Godot Camera shake without target I'm working with godot 3.2 to make this screen shake, but my issue is that i don't have a target, like in the example, in the example code, it's a kinematic body that is being followed by the camera, i don't have that, i'm making a match three type of game, so i don't use those. What i tried it's to use the main node, in which the game loop logic is executed but the camera shake didn't work, also tried with another elementsd but it failed beacuse they are mostly HUD elements and shows an error about global positions. Also i not sure how to get the board grid, since it's instantiated by code. How i can make shake camera without a target or get a similar effect?


Camera type for puzzle game like tetris I can't find what is the name of the camera type. Sided camera view seems logical but not correct thought


What game systems exist which uses camera input? The group and I is in the middle of a semester project where we are currently researching on which game systems are using camera as input or as an interactive medium? We would like some help listing some of the game systems which uses camera input, as it seems hard to find other examples. Currently we know that webcam browser games uses camera input (Newgrounds webcam games), as well as the xbox kinect. I know this questions seems rather vague, though I still hope some people is capable of helping.


What is the term for making an object transparent when it blocks the player's view? In many games if your camera gets too close to certain objects, or the object starts to block your screen, the game turns it transparent so you can still see. What is the name for this effect? It is not occlusion culling. The model does not reduce its polygons, it simply just gets transparent so that you can look through it.


Unreal Y Axis boundary on a Camera Bounding Box I was wondering if I could get some help with modifying a Blueprint I'm currently using for a project in Unreal Engine. I am currently attempting to make a side scrolling platformer game and I'm using a camera bounding box Blueprint to restrict where the camera can move when tracking the player's movement, based on the following series of tutorials on YouTube by JvtheWanderer How to make a Metroidvania 2D Camera Blueprint System on UE. The camera bounding box works as intended, in that it prevents the camera from moving beyond the limitations of the camera box placed within the scene, but I want to go even further than that and establish a limitation within the camera bounding box that not only limits the camera's movement but also prevents the player from moving on the Y axis beyond the box's boundaries. Pretty much every platformer from Super Mario to Sonic the Hedgehog to Castlevania, have such boundary limitations, usually at the very start of the level and also frequently at the end. The limitation on the Y axis boundary is also frequently used to lock the player into a particular area for forced enemy encounters, mini boss fights as well as proper boss battles, a limitation that lasts until the player has vanquished the threat. I wish to implement similar boundaries on the camera bounding boxes within my project to restrict where the player can go without having to place walls everywhere to keep the player from wandering beyond the level's limits. Using walls to restrict the player's movement is fine for indoor areas, but it ends up looking distractedly out of place in outdoor areas if used in excess. I've included screenshots below of the Construction Script amp Event Graph from the SideScrollerCamera Blueprint I'm using. I would also include the Viewport and the Level Blueprint as well, except that the time being, I am unable post more than two links. Construction Script Event Script Any help with this matter would be greatly appreciated.


Camera rotation in 4D What practical choices do I have in order to rotate a camera in 4D space? I would like to make it as intuitive as possible. A camera in 3D space can be represented by a point where it is located the forward vector (movement using the w and s buttons) the left (movement using the a and d buttons) the up vector (eg. space and ctrl ) In 4D space, the an additional axis is added the fourth axis vector (eg. q and e ) All of the vectors remain orthogonal to eachother. So the movement is trivial.


How to avoid gimbal lock in Unreal Engine (c )? I created an orbit camera (sometimes called turntable camera similar to the one with the "use UE3 orbit controls" setting in a static mesh view). I attached the camera to a USpringArmComponent with a TargetArmLength set to 400. In the tick function, I rotate the arm with this simple method Simple, clamped version FRotator Rotation CameraSpringArm gt GetComponentRotation() Rotation.Yaw CameraInput.X CameraRotationSpeed Rotation.Pitch FMath Clamp(Rotation.Pitch CameraInput.Y CameraRotationSpeed, 85.0f, 85.0f) CameraSpringArm gt SetRelativeRotation(Rotation) I had to clamp the pitch to hide the gimbal lock problem. But this prevent users to rotate completely around objects. I don't understand why the Z rotation (the yaw) occurs on the world z axis ( FVector UpVector which is (0, 0, 1)) and not on the local z axis. It turns out that this is exactly what I want. I tried to solve this gimbal lock problem with this other method Taken from https answers.unrealengine.com questions 232923 how can i avoid gimbal lock in code.html FRotator RotationDelta(CameraInput.Y CameraRotationSpeed, CameraInput.X CameraRotationSpeed, 0.f) FTransform NewTransform CameraSpringArm gt GetComponentTransform() NewTransform.ConcatenateRotation(RotationDelta.Quaternion()) NewTransform.NormalizeRotation() CameraSpringArm gt SetWorldTransform(NewTransform) It works, but this time, the Z rotation (yaw) occurs on the local Z axis. How can I change it to rotate around the world Z axis, and the local Y axis, without gimbal lock? I tried this hybrid solution, but the gimbal lock is still there Hybrid FRotator RotationDelta(CameraInput.Y CameraRotationSpeed, 0.f, 0.f) FTransform Transform CameraSpringArm gt GetComponentTransform() FRotator Rotation CameraSpringArm gt GetComponentRotation() Rotation.Yaw CameraInput.X CameraRotationSpeed Transform.SetRotation(Rotation.Quaternion()) Transform.ConcatenateRotation(RotationDelta.Quaternion()) Transform.NormalizeRotation() CameraSpringArm gt SetWorldTransform(Transform) I did solve this problem (a long time ago) in OpenGL using quaternions, so I tried this version Quaternion FRotator Rotator CameraSpringArm gt GetComponentRotation() FQuat Quaternion Rotator.Quaternion() Rotate around the world Z axis Quaternion FQuat(FVector UpVector, FMath DegreesToRadians(CameraInput.X CameraRotationSpeed)) Rotate around the local Y axis Quaternion FQuat(Rotation.RotateVector(FVector RightVector), FMath DegreesToRadians(CameraInput.Y CameraRotationSpeed)) CameraSpringArm gt SetRelativeTransform(Quaternion) But this does not work. I also tried this Quaternion transform FTransform Transform CameraSpringArm gt GetComponentTransform() Transform.ConcatenateRotation(FQuat(FVector UpVector, FMath DegreesToRadians(CameraInput.X CameraRotationSpeed))) Transform.ConcatenateRotation(FQuat(Rotation.RotateVector(FVector RightVector), FMath DegreesToRadians(CameraInput.Y CameraRotationSpeed))) Transform.NormalizeRotation() CameraSpringArm gt SetWorldTransform(Transform) without success.


Follow camera for car object I have a car object in my game that has a car location like any other object. It is able to steer with bicycle KInematics and even rotates while it drives from a car heading vector. Now I need the camera to follow the car. I put the camera position 10 up and 10 behind the car. But I'm confused on where to make the camera look. I tried this pseudo code lookatcamera carLocation.x 5 cos(carHeading), carLocation.y, carLocation.z 5 sin(carHeading)


Can I position a player avatar behind the camera based on rotation? I'm currently reverse engineering a video game where what's rendered on the screen depends on the proximity of the player avatar to the camera. As such, for my freecam to work properly, I need to bring the player avatar along with the camera. Since I can't yet find how the player avatar is rendered to the screen, the next best thing I can think to do is to place the player avatar behind the camera at all times (I suppose essentially like making the player avatar orbit the camera, but always be behind it). I just can't quite pin down how to make this happen. The values I have are as follows Player Avatar X Y (Up Down) Z Camera X Y (Up Down) Z Pitch (In degrees natively, but converted to radians for my calculations) Yaw (In degrees natively, but converted to radians for my calculations) World Orientation To get my camera to move forward in the direction I'm pointing my mouse when pressing the Y key, these are the calculations I'm using (code is in Lua) Camera XYZ values local camCoordX readFloat(" cameraBase 990") Camera X local camCoordY readFloat(" cameraBase 994") Camera Y local camCoordZ readFloat(" cameraBase 998") Camera Z Camera pitch and yaw local pitch math.rad(readFloat(" cameraBase 1540")) Pitch local yaw math.rad(readFloat(" cameraBase 1544")) Yaw Sine and cosine calculations local sinOfYaw math.sin(yaw) Sine of Yaw local cosOfYaw math.cos(yaw) Cosine of Yaw local sinOfPitch math.sin(pitch) Sine of Pitch local cosOfPitch math.cos(pitch) Cosine of Pitch If Y key is pressed, write new camera XYZ values accordingly if isKeyPressed(VK Y) then writeFloat(" cameraBase 990", camCoordX (sinOfYaw speed)) writeFloat(" cameraBase 994", camCoordY (sinOfPitch speed)) writeFloat(" cameraBase 998", camCoordZ (cosOfYaw speed)) end Based on that information, is it feasible for me to accomplish placing the player avatar behind the camera at all times based on rotation? I'm open to other suggestions or options as well. Thank you for any help you can offer!


Simulating a real camera's perspective projection I'm trying to simulate a real camera's perspective projection of straight, parallel lines running along the ground (one point perspective) by mapping the real world 3D coordinates of the lines to 2D screen coordinates. Suppose the camera's tilt angle is known, is there a way to calculate the slopes coordinates expression of these lines projected on to the 2D plane? Which parameters of the camera are needed? My understanding is that when the camera is tilted, the vanishing point is effectively shifted. But does tilting the camera cause the same changes in the perspective of the lines as moving the camera lower to the ground (closer to the lines)?


How to figure out which tiles are within view, and where to draw them in the grid? I know there are a few questions on here similar to mine, but none of them seem to fit my needs. I'm using PyGame to implement a tile based game similar to Final Fantasy or Zelda from the early Nintendo and Super Nintendo generation consoles. The issue I'm running into is that I can't figure out how make a general way to render and position the tiles within view of the player camera. Once the camera starts moving, finding how much of an image is present in the camera view is very difficult, and then positioning it correctly is more complicated. Any suggestions on how I can figure out a general way to create the grid correctly?


How can I track a falling ball with a camera? I have been trying to get my camera to follow a falling ball but with no success. here is the code float cameraY (FrustumHeight 2) ((ball.getPosition().y) 2) (FrustumHeight 2) if (cameraY lt FrustumHeight 2 ) cameraY FrustumHeight 2 camera.position.set(0f,cameraY, 0f) Gdx.app.log("test",camera.position.toString()) camera.update() camera.apply(Gdx.gl10) batch.setProjectionMatrix(camera.combined) batch.begin() batch.draw(backgroundRegion, camera.position.x FrustumWidth 2, cameraY (FrustumHeight 2) , 320, 480) batch.draw(ballTexture, (camera.position.x FrustumWidth 2) ball.getPosition().x, cameraY ball.getPosition().y (FrustumHeight 2) , 32, 32) I'm sure I am doing this completely wrong what is the correct way to do this?


How to avoid gimbal lock I am trying to write code with rotates an object. I implemented it as Rotation about X axis is given by the amount of change in y coordinates of a mouse and Rotation about Y axis is given by the amount of change in x coordinates of a mouse. This method is simple and work fine until on the the axis coincides with Z axis, in short a gimble lock occurs. How can I utilize the rotation arount Z axis to avoid gimbal lock.


How can I find the opposite angle and position of the camera? In this project I have a character and a camera that follows it. The camera has a position relative to the character that was defined as (x 0, y 0, z 0) and also its rotation I found a value close to its position and opposite angulation, but not really the correct value By pressing the Q key, the camera shifts to the position and angulation that I have discovered. Releasing the Q key, the camera returns to its initial position IN GAME As you can see, the inversion is not 100 correct. One of the ways I thought, is a way where I take this relative value from the camera (x 0, y 0, z 0) and with that I put the character's mesh at the location (x 0, y 0, z 0) at the level and so, as the camera will be (for example) x 250, y 0, z 300, it's just I invert the value of x. The angulation is simpler to deduce, but it would be interesting for me to also derive its relative value (0, 0, 0). EDIT 1 (Attempt that I did and that almost worked out) By clicking the down arrow to the left of the values, you can select whether you want the variable to be Relative or World (I did not know that) Before it was all 0, it now has a value Taking the minus sign, I was able to figure out the opposite position New position It happens that at the time of changing the angulation from relative to absolute, a conversion is not made I can not get absolute value equivalent to relative. What happens is that the value 0, 0, 0 is also defined for the absolute rotation. In the image below the camera was exactly in the same position as the VR camera I discovered by trial and error the equivalent angulation between relative and absolute BLUEPRINT The code works correctly, but I feel that again I did not get exactly the position and opposite angles. Here are some screenshots of the game Local X with NORMAL CAMERA Local X with OPPOSITE CAMERA Local Y with NORMAL CAMERA Local Y with OPPOSITE CAMERA Note that in the opposite camera you can see the end of the world (sky) from wherever you are, which is not the case with the normal camera. I noticed this, and so, I think once again I did something wrong.


Render a 3D scene in multiple windows extended panoramic view Is there any resource location on how to view a 3D scene from an application or a game on multiple windows or monitors? Each window should continue drawing from where the neighbouring one left off (in the end, the result should be a mosaic of the scene). My idea is to use a camera for each window and have a reference position and orientation for a meta camera object that is used to correctly offset the other cameras (e.g. like in the above figure where the render targets of the two cameras reproduce the star when stitched together). Since there are quite some elements to consider (window specs, viewport properties, position orientation of each render camera), what is the correct way to update the individual cameras considering the position and orientation of the central, meta camera? I currently cannot make the cameras present the scene contiguously (and I am reluctant in working out the transformations without checking whether this is the actual way of doing things).


Camera (pole cam) implementation problem In my project I have simple scene graph to render whole scene and Bullet physics SDK to provide physics simulation. Each rendered object is represented as scene node. Camera always has target and located behind this target. Target can be any scene node. First, I want to describe my rendering pipeline. 1)When time to render whole scene, we calculate view matrix from target's world matrix. We take offset vector in order to locate camera behind targeted scene node and transform it to scene node world's coordinate. Then add position of target with transformed offset vector. Finally, get inverse matrix of scene node. This method always is called before rendering whole scene. HRESULT CameraNode SetViewTransform(Scene pScene) If there is a target, make sure the camera is rigidly attached right behind the target if(m pTarget) Mat4x4 mat m pTarget gt VGet() gt ToWorld() Vec4 at m CamOffsetVector Vec4 atWorld mat.Xform(at) Vec3 pos mat.GetPosition() Vec3(at) mat.SetPosition(pos) VSetTransform( amp mat) Set normal matrix and calculate inverse matrix m View VGet() gt FromWorld() Get inversed matrix pScene gt GetRenderer() gt VSetViewTransform( amp m View) return S OK 2)Then, when time to render particular scene node, we calculate projection matrix and send it to the vertex shader. Mat4x4 CameraNode GetWorldViewProjection(Scene pScene) Mat4x4 world pScene gt GetTopMatrix() Mat4x4 view VGet() gt FromWorld() Mat4x4 worldView world view return m Projection worldView I have next problem, when I calculate view matrix from target's world matrix and locate target on coordinate ( x 0 y 10 z 1) it started to fall due to physics and jerk twitch. 1 When I set view camera matrix only offset position. Scene node falls without jerking twitching. 2 How I can fix this jerking twitching when camera is following the scene node ? I suppose that it is problem of matrices multiplication, when Bullet SDK sets new coordinates to scene node. But I have no idea how it can be solved.


Ortbit camera rotation multiplication order with quaternions? So I switched my camera to use quaternions and the first thing I noticed is that things started to 'roll' even though I'm not using any roll values. I looked it up and I found that people suggest that using rotation horizontal rotation vertical solves the issues instead of rotation rotation horizontal vertical which I thought was the more intuitive thing from doing matrix multiplication. The explanations I read as to why one works and the other doesn't were pretty vague and unclear. My question is why does it work this way? what's wrong with 'rotation h v ? Sample code float Horizontal 0 float Vertical 0 if (Keys 'W' Key Held) Camera gt Position Camera gt Forward() CamMovSpeed DeltaTime if (Keys 'S' Key Held) Camera gt Position Camera gt Forward() CamMovSpeed DeltaTime if (Keys 'A' Key Held) Camera gt Position Camera gt Right() CamMovSpeed DeltaTime if (Keys 'D' Key Held) Camera gt Position Camera gt Right() CamMovSpeed DeltaTime if (Keys 'E' Key Held) Camera gt Position vec Up CamMovSpeed DeltaTime if (Keys 'F' Key Held) Camera gt Position vec Up CamMovSpeed DeltaTime mouse int dx Mouse gt x Mouse gt LastX Mouse gt LastX Mouse gt x int dy Mouse gt LastY Mouse gt y Mouse gt LastY Mouse gt y if (Mouse gt MMB Key Held) pan Camera gt Position (Camera gt Up() dy Camera gt Right() dx) SpeedMul 2 DeltaTime if (Mouse gt RMB Key Held) orbit Horizontal dx SpeedMul 10 DeltaTime Vertical dy SpeedMul 10 DeltaTime if (Mouse gt Wheel) zoom Camera gt Position Camera gt Forward() Mouse gt Wheel SpeedMul 10 DeltaTime if (Horizontal ! 0 Vertical ! 0) quat QVertical(vec Right, Vertical) quat QHorizontal(vec Up, Horizontal) Camera gt Rotation QHorizontal Camera gt Rotation QVertical this works Camera gt Rotation Camera gt Rotation QHorizontal QVertical this doesn't Camera gt Rotation.Normalize()


How far back should I move my camera to fit a given GameObject in frame? In Unity with C , I want to calculate the minimum distance that my perspective camera has to be from a given GameObject (a procedurally generated mesh), so that the object is fully framed by the camera and leaving the least space possible around it in the screen. In other words, fully framed means that there is no part of the object outside the view area. To make things easier, my camera does not need to rotate or move it's fully static, with the exception of one axis to zoom in or out in order to frame the target object. So, in fact, we could summarize my problem as a zoom problem (not using FOV to zoom) where I need to frame a procedurally generated mesh whose size varies considerably. Would anyone be kind enough to point me in the right direction with code snippets, suggestions, etc?


How can I emulate Diablo 3's Isometric view using Perspective? Using DX11, SimpleMath I am building a isometric game like Diablo 3 in 3D and I want to use a perspective camera that emulates their top down view. Projection Matrix CreatePerspectiveFieldOfView(1, width height, 0.1f, 100.0f) But after this I am a bit unsure how I am suppose to rotate the camera. I assume I could just do p Vector3(10, 10, 10) to get a 45 degree angle at any given p. How do I properly position, and rotate the camera and point it at position p, to mimic Diablo 3 view?


Looking for online resources to understand game camera properties What are some good online resources to understand game camera properties, such as fov, aspect ratio and more?


How do I move a camera to a new X and Y position when the player collides with a certain object? The lowdown is this I'm making a 2D overhead game that takes place in separate screens in a room. Each screen is separated by a few blocks of black space (to give the impression of screens being separate rooms) and a rectangular "transition block" in doorways. My idea is, once a player touches this block, they are moved to the next adjacent screen along with the camera instantly. I can move a player to the next screen this way, the big hangup that I'm having is moving the camera as well. I want every collision box to have the coordinates needed to set the camera around the next screen once player box collision happens, similar to the setup I have with the player character.


How do I output a webcam stream to a 2D canvas with SharpDX in C ? I'm writing an application for the Oculus Rift using the SharpOVR library to access HMD position data. I decided it is reasonable to use SharpDX to also output webcamera streams. Unfortunately, all SharpDX documentation is basically a copy paste from C documention and I only know basic C . C uses a different style, class names, etc. The MediaFoundation samples are also C only. I'm trying to write a pretty simple part that renders 2 videos from 2 webcams. I've managed to get webcameras list with this code, but I'm failing to init one it currently fails at source.Start(descriptor, null, time) According to the exception, I need to bind all Stream events first. Or I am missing something I need to init? Can one help with further actions from camera start till outputting to monitor? I know the code shouldn't be too hard, problem is adapting it to C .


GLM Camera attached to model moves in opposite direction from the model I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform ParentsWorldTransform LocalTransform). This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4. All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's. Transformation Component Update Code m world transformation m local transformation If we have a parent object if (m parent transform component) m world transformation m parent transform component gt GetWorldTransformation() m world transformation Camers position buffer being updated BufferData.view m transformation component gt GetWorldTransformation() m camera buffer gt SetData() I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.


FlxSprite ignore camera follow in flixel I am using flixel v2.5 and am using FlxG.camera.follow to get the camera to follow the player. I have a background FlxSprite that I don't want to move with the camera. Is there a way I can set this FlxSprite to stay in the same place on the screen? I would also like to have a GUI HUD that stays fixed to the screen, and was thinking I could do this the same way.


How does time dependent camera rotation with a mouse work? The commonly used equation for camera rotation with a mouse does not involve time. This make sense since higher frame rates have smaller changes in mouse position and vise versa so it all evens out. If time slows down or speeds up, however, camera rotation from the mouse does not adjust accordingly. Just as you move slower when time is slowed, logically I also want rotating to be slower. One option is to multiply the change in position of the mouse with the same multiplier I'm using on time, but shouldn't it be possible to have change in rotation and change in time in the same equation, independent from framerate?


How do I create a bounding frustum from a view projection matrix? Given a left handed Projection matrix, a left handed View matrix, a ViewProj matrix of View Projection How do I create a bounding Frustum comprised of near, far, left, right and top, bottom planes? The only example I could find on Google (Tutorial 16 Frustum Culling) seems to not work for example, if the math is used as given, the near plane's distance is a negative. This places the near plane behind the camera...