Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7864487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:48:10+00:00 2026-06-02T23:48:10+00:00

How do I import and attach a PNG or GIF to a shape in

  • 0

How do I import and attach a PNG or GIF to a shape in Box2dWeb?

The best resource I could find online is at: http://www.jeremyhubble.com/box2d.html

However, this “tutorial” doesn’t give much explanation about how images are actually used. So it is clearly possible, but I can’t get the userData trick to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:48:11+00:00Added an answer on June 2, 2026 at 11:48 pm

    I’ve answered this for you over on gamedev now (along with an example), but here’s the bottom line:

    You are generally responsible for rendering the state of your box2d world – the “userData trick” you refer to is not really to do with the box2d framework.

    userData is a placeholder for arbitrary data that you want to associate to a body. This could be anything – a string, function, object, etc. This data is typically used to help you render your world during the update loop, which is exactly what the resource you linked to does – If you look at the processObjects function it uses the imgsrc value to create an Image object and draws it onto the canvas at the correct location. (This isn’t really a good idea because the image is created once per object per iteration – I would suggest it should only be created once)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import httplib2 from urllib import urlencode h = httplib2.Http() h.add_credentials('zackster@gmail.com', 'PassWord') data = dict(key=ThisIsMyApiKeyICopiedAndPastedIt)
I have been trying to play a video that was converted using http://www.mirovideoconverter.com/ to
$ sudo python2.6 >>> import Skype4Py >>> skype = Skype4Py.Skype() >>> skype.Attach() And nothing
For some reason the system does not find the attach and detach methods for
import org.joda.time.LocalDate; public class Test { public static void main(String[] args) { long time=System.currentTimeMillis();
import java.awt.*; import javax.swing.*; import javax.swing.GroupLayout; /** * @author Ene Ion */ public class
import MySQLdb import sys from libdesklets.controls import Control from IDBConnection import IDBConnection class DBConnection(Control,
import java.io.*; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class ExplicitChannelRead { /** * @param args
import re , strings , os ,sys sentence = abcdefghijkl for i in range(0,len(sentence),3):
import java.util.Scanner; public class CourseSplitter { public static void main(String args[]){ Scanner keyboard =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.